Code Sketch


Flowers In Pitchers
By: Samiksha Srivastav
Category: Art
cleari
setSpeed(fast)

val cb = canvasBounds //just to define the canvas bounds
//set the pot clr
val potClr = cm.linearGradient(-200, 0, Color(88, 47, 72), 100, 150, Color(255, 143, 49))
//set the background clr
val bgClr = cm.linearMultipleGradient(cb.x, cb.y, cb.x, cb.y + cb.height,
    Seq(0.4, 0.41, 1),
    Seq(Color(0, 196, 65), white, Color(244, 239, 64)))
setBackground(bgClr)

// made the picture of pot here
val pot = Picture {
    setFillColor(potClr)
    setPenColor(potClr)
    left(-180, 100)
    right(50, 100)
    repeat(4) {
        left(20, 30)
    }
    setHeading(0)
    forward(100)
    right(100)
    repeat(4) {
        left(20, 40)
    }
    right(20)
    right(50, 90)
    setPosition(-155, 90)
    setPenColor(white)
    setHeading(0)
    forward(100)
}

 //define the shape of flower's petal
def shape() {
    savePosHe()
    left(45)
    right(90, 20)
    right(90)
    right(90, 20)
    restorePosHe()
}

//make a complete flower
def block() {
    shape()
    right(60)
}

//made the flowers picture
val flower = Picture {
    savePosHe()
    setPenColor(ColorMaker.hsl(120, 0.40, 0.45))
    right()
    hop(-60)
    left()
    right(60, 100)
 
    setPenColor(cm.darkSlateGray)
    saveStyle()
    setFillColor(randomColor)
    
    repeat(6) {
        block()
    }
    restoreStyle()
    restorePosHe()
    savePosHe()
    right()
    hop(-80)
    left()
    left(60, 100)
    setPenColor(cm.darkSlateGray)
    saveStyle()
    setFillColor(randomColor)
    repeat(6) {
        block()
    }
    restoreStyle()
    restorePosHe()
    savePosHe()
    right()
    hop(-70)
    left()
    right(90, 150)
    setPenColor(cm.darkSlateGray)
    saveStyle()
    setFillColor(randomColor)
    repeat(6) {
        block()
    }
    restoreStyle()
    restorePosHe()
    savePosHe()
    left()
    hop(40)
    right()
    left(150, 60)
    setPenColor(cm.darkSlateGray)
    saveStyle()
    setFillColor(randomColor)
    repeat(6) {
        block()
    }
    restoreStyle()
    restorePosHe()
    savePosHe()
    left()
    hop(90)
    right()
    left(90, 100)
    setPenColor(cm.darkSlateGray)
    saveStyle()
    setFillColor(randomColor)
    repeat(6) {
        block()
    }
    restoreStyle()
    restorePosHe()
}

//
val flowerPot = picColCentered(pot, flower)
val tableflower = picRowCentered( flowerPot,flowerPot)

drawCentered(tableflower)