Code Sketch


Flower Made With Pictures
By: Anay Narendra Kamat
Category: Art
clear()

def petalHalf = Picture.fromPath { x =>
    x.moveTo(0, 0) 
    x.arc(0, 150, 90)   
}.thatsFilledWith(yellow).thatsTranslated(0, 50)

def petalSet = picStack(
    petalHalf,
    petalHalf.withFlippedX.thatsRotated(-360/18)
)

def petalList = for{
    angle <- 0 to 360 by 360/18
    petal = petalSet.thatsRotated(-angle)
} yield petal

def flowerPetals = picStack(petalList)

def flowerInner = Picture.circle(50).thatsFilledWith(yellow)


def flowerLine = Picture.line(0, 35).thatsStrokeSized(10).thatsStrokeColored(brown)

def flowerLineList = for{
    angle <- 0 to 360 by 360/18
    line = flowerLine.thatsRotated(-angle)
} yield line

def flowerLines = picStack(flowerLineList)

def flower = picStack(
    flowerPetals,
    flowerInner,
    flowerLines
)

flower.draw