Code Sketch


HAPPY DIWALI
By: CHICANE FERNANDES
cleari()

setSpeed(superFast)
setPenColor(black)

def backgroundColor= cm.radialMultipleGradient(
    0, 0,
    400,
    Seq(0.4,0.5,0.7,0.9),
    Seq(cm.orange,cm.gold,cm.orangeRed,cm.maroon), 
    false)
    setBackground(backgroundColor)

def shapes (steps:Long,size:Double,side:Long)
{
    if(steps==0)
    {
        
    }
    else
    {
        forward(size)
        right(360/side)
        shapes(steps-1,size,side)
    }
}

setFillColor(cm.blue)
setPosition(-40,160)
right(90)
shapes (6,80,6)
setFillColor(cm.violet.fadeOut(0.5))
setPosition(-40,160)
right(0)
shapes (6,40,6)
setFillColor(cm.indigo.fadeOut(0.5))
setPosition(40,160)
right(60)
shapes (6,40,6)
setFillColor(cm.deepPink.fadeOut(0.7))
setPosition(80,90)
right(60)
shapes (6,40,6)
setFillColor(cm.violet.fadeOut(0.5))
setPosition(40,21)
right(60)
shapes (6,40,6)
setFillColor(cm.darkTurquoise.fadeOut(0.6))
setPosition(-40,21)
right(60)
shapes (6,40,6)
setFillColor(cm.magenta.fadeOut(0.5))
setPosition(-80,90)
right(60)
shapes (6,40,6)

setFillColor(cm.mediumSeaGreen)
setPenColor(black)
setPosition(-40,21)
right(60)
shapes (4,10,4)
setFillColor(cm.yellowGreen)
setPosition(-30,21)
shapes (4,10,4)
setFillColor(cm.greenYellow)
setPosition(-20,21)
shapes (4,10,4)
setFillColor(cm.limeGreen)
setPosition(-10,21)
shapes (4,10,4)
setFillColor(cm.yellow)
setPosition(0,21)
shapes (4,10,4)
setFillColor(cm.lawngreen)
setPosition(10,21)
shapes (4,10,4)
setFillColor(cm.mediumAquamarine)
setPosition(20,21)
shapes (4,10,4)
setFillColor(cm.chartReuse)
setPosition(30,21)
shapes (4,10,4)

setPenColor(black)
setFillColor(cm.thistle.fadeOut(0.4))
setPosition(40,160)
right(120)
forward(80)
right(120)
forward(80)
setFillColor(cm.paleVioletRed)
right(30)
forward(10)
right(90)
forward(80)
right(90)
forward(10)
setFillColor(cm.thistle.fadeOut(0.4))
right(30)
forward(160)
right(-120)
forward(80)
right(-120)
forward(80)

setPenColor(black)
setFillColor(cm.gold)
setPosition(40,12)
right(-150)
forward(130)
turn(60,50)
right(-90)
forward(10)
right(-90)
forward(44)
right(40)
forward(5)
right(20)
forward(136)

right(-90)
forward(10)
right(-90)
forward(180)
right(-120)
forward(11)
right(-60)
forward(175)

right(-90)
forward(70)
right(-90)
forward(140)
turn(-50,40)
right(90)
forward(10)
right(80)
forward(48)
right(-40)
forward(128)

right(180)
forward(180)
right(-60)
forward(12)
right(-120)
forward(185)

right(180)
forward(175)
right(-120)
forward(12)
right(-60)
forward(170)

right(180)
forward(180)
right(-120)
forward(12)
right(-60)
forward(170)

right(180)
forward(180)
right(-120)
forward(11)
right(-60)
forward(175)

right(180)
forward(170)
right(-120)
forward(12)
right(-60)
forward(160)

def words()
{
    setPenFont(Font("Monospaced", 60,BoldFont))
right(0)
setPenColor(cm.navy)
setPosition(-290,180)
write("HAPPY")
setPenColor(cm.navy)
setPosition(-320,100)
write("DIWALI!")
}

words()

def shape () {
  savePosHe ()
  left (45)
  right (90,80)
  right (90)
  right (90,80)
  restorePosHe ()
}
def block () {
  shape ()
  right (18)
}
setPenColor(black)
setFillColor(cm.orangeRed.fadeOut(0.5))
setPosition(200,-50)
repeat (20) {
  block ()
}

setPosition(-280,-100)
setFillColor(cm.maroon)
right(180)
turn(180,100)
right(-90)
forward(100)
setFillColor(cm.yellow.fadeOut(0.9))
right(120)
left(60, 120)
left(150)

right(30)
left(60, 120)
left(150)

right(-90)
forward(100)

setPenFont(Font("Monospaced", 15,BoldFont))
right(90)
setPenColor(cm.black)
setPosition(100,180)
write("BY - CHICANE FERNANDES")
setPosition(100,160)
write("STD-8A")
setPosition(100,140)
write("HOLY FAMILY HIGH SCHOOL")