Code Sketch


Flower (with pics)
By: Gen Artist
Category: Art
cleari()

val cb = canvasBounds
val bg = cm.linearGradient(cb.x, cb.y, cm.black, cb.x + cb.width, cb.y + cb.height, cm.gray, false)
setBackground(bg)

val fillc = cm.linearGradient(0, 0, ColorMaker.hsl(40, 1.00, 0.40), 0, 150, cm.yellow, false)

def halfPetal = Picture {
    left(45)
    right(90, 120)
}

def petal = picStack(halfPetal, halfPetal.withFlippedX)
    .withFillColor(fillc)
    .withPenColor(cm.darkGoldenrod)
    .withPenThickness(1)

val nump = 7

def flower(petals: Int): Picture = {
    if (petals == 1)
        petal
    else
        picStack(petal, flower(petals - 1).thatsRotated(360.0 / nump))
}

draw(flower(nump))