Code Sketch
Gudi Padwa
cleari
setSpeed(fast)
left
hop(300)
right
hop(230)
setPenColor(Color(136, 58, 11))
setPenFont(Font("Monotype Corsiva", 100) )
write("Happy")
right
right
hop(100)
right
hop(100)
right
setPenColor(Color(136, 58, 11) )
setPenFont(Font("Monotype Corsiva", 100) )
write("Gudi Padwa ")
def flame2 = Picture.fromPath { x =>
x.moveTo(0,0)
x.arc(0, 150, 80)
x.arc(0, 0, 80)
}
def initState=(1,+1)
animateWithState(initState) {
case (20,1) =>
(20,-1)
case (10,-1) =>
(10,+1)
case (scale,increment) =>
erasePictures()
def gradients =
cm.linearMultipleGradient(
0, 307,
0,-307,
Seq(0,1),
Seq(Color(255, 177, 178),Color(255, 255, 0)),
false
)
setBackground(gradients)
def colors =
cm.linearGradient(
590, 0,
yellow,
200, 0,
Color(153, 255, 153),
true)
def colors2 =
cm.linearGradient(
-010, 0,
darkGreen,
100, 0,
yellow,
false)
def color3 =
cm.linearGradient(
590, 0,
brown,
100, 0,
Color(195, 146, 27),
true)
def color4 =
cm.linearGradient(
-67, 0,
Color(102, 0, 102),
100, 0,
red,
true)
def color5 =
cm.linearGradient(
10,-180,
Color(255, 255, 0),
10, 250,
red,
true)
def color6 =
cm.linearGradient(
200, 0,
Color(255, 51, 51),
250, 0,
Color(255, 255, 153),
true)
def rectangle2 = Picture.rect(50, 920)
rectangle2
.thatsStrokeColored(Color(151, 99, 11))
.thatsFilledWith(color3)
.thatsTranslated(-463, 265).draw
def rectangle3 = Picture.rect(10, 90)
def rectangle4 = Picture.rect(105, 76)
def arcOne = Picture.arc(100, 90)
def arcTwo = Picture.arc(40,70)
def arcThree = Picture.arc(80, 70)
def darkGreen = Color(0,155,82)
def round = Picture.circle(10)
def lineOne = Picture.line(72, 2)
def oval = Picture.ellipse(180, 90)
def oval2 = Picture.ellipse(140, 40)
def round3 = Picture.circle(10)
def shape2 = Picture.fromPath { x =>
x.moveTo(0,0)
x.arc(-45, 10, 180)
x.arc(30, 5, 185)
x.arc(-80, -10, 200)
def toran = picStack(
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(-390, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(-244, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(-100, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(43, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(187, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(330, 380),
arcOne
.thatsStrokeColored(darkGreen)
.thatsStrokeSized(6)
.thatsRotated(-134).thatsTranslated(470, 380)
)
toran.draw
def leaf = picStack(
arcTwo.thatsStrokeColored(darkGreen),
arcTwo.thatsRotated(180)
.thatsStrokeColored(darkGreen)
.thatsTranslated(53, 39)
)
def leaves = picStack(
leaf.thatsFilledWith(colors2)
.thatsTranslated(-420, 120)
.thatsRotated(-18),
leaf.thatsFilledWith(colors2)
.thatsTranslated(-437, 102)
.thatsRotated(-18),
round
.thatsStrokeColored(yellow)
.thatsFilledWith(Color(255, 102, 0))
.thatsTranslated(-350, 260)
)
leaves.thatsTranslated(-10, 17).draw
leaves.thatsTranslated(-90, 17).draw
leaves.thatsTranslated(100, 10).draw
leaves.thatsTranslated(250, 10).draw
leaves.thatsTranslated(390, 10).draw
leaves.thatsTranslated(530, 10).draw
leaves.thatsTranslated(660, 10).draw
leaves.thatsTranslated(770, 14).draw
def shape = Picture{
hop(50)
left
forward(30)
left
forward(60)
right
forward(30)
right
hop(60)
right(180)
forward(30)
left
forward(60)
right
forward(30)
}
def pot = picStack(arcThree
.thatsRotated(-35)
.thatsScaled(1.3,1.2)
.thatsStrokeColored(Color(255, 190, 0))
.thatsTranslated(0,65),
arcThree
.thatsRotated(144)
.thatsScaled(1.3,1.2)
.thatsStrokeColored(Color(255, 190, 0))
.thatsTranslated(95, 60),
rectangle3,
lineOne
.thatsStrokeColored(Color(255, 190, 0))
.thatsTranslated(10, 118),
rectangle4
.thatsTranslated(08,11)
.thatsStrokeColored(Color(255, 190, 0)),
shape
.thatsStrokeSized(7)
.thatsTranslated(75, 36),
round3
.thatsStrokeColored(red)
.thatsStrokeSized(24)
.thatsFilledWith(red)
.thatsScaled(0.2,0.2)
.thatsTranslated(59, 36),
round3
.thatsStrokeColored(red)
.thatsStrokeSized(24)
.thatsFilledWith(red)
.thatsScaled(0.2,0.2)
.thatsTranslated(62, 72),
round3
.thatsStrokeColored(red)
.thatsStrokeSized(24)
.thatsFilledWith(red)
.thatsScaled(0.2,0.2)
.thatsTranslated(26, 39),
round3
.thatsStrokeColored(red)
.thatsStrokeSized(24)
.thatsFilledWith(red)
.thatsScaled(0.2,0.2)
.thatsTranslated(29, 72)
)
def equTriangle = Picture{
hop(-250)
forward(400)
right(120)
forward(400)
right(120)
forward(400)
}
def cloth1 = picStack(
equTriangle
.thatsRotated(-30)
.thatsScaled(0.3,1.0)
.thatsTranslated(80, 0)
.thatsFilledWith(color4),
rectangle3
.thatsFilledWith(yellow)
.thatsScaled(1.3,2.8)
.thatsTranslated(44, -216),
round
.thatsFilledWith(darkGreen)
.thatsTranslated(60, -202),
round
.thatsFilledWith(darkGreen)
.thatsTranslated(87, -202),
round
.thatsFilledWith(darkGreen)
.thatsTranslated(115, -202),
round
.thatsFilledWith(darkGreen)
.thatsTranslated(145, -202)
)
def leftChain = picStack(
round
.thatsFilledWith(yellow)
.thatsTranslated(0, -20),
round
.thatsFilledWith(orange)
.thatsTranslated(0, -40),
round
.thatsFilledWith(yellow)
.thatsTranslated(0, -59),
round
.thatsFilledWith(orange)
.thatsTranslated(10, -80),
round
.thatsFilledWith(yellow)
.thatsTranslated(20, -99),
round
.thatsFilledWith(orange)
.thatsTranslated(35, -115)
)
def Chain = picStack(
leftChain,
leftChain.withFlippedX
.thatsTranslated(88, -2)
)
def gudi = picStack(
rectangle3
.thatsRotated(120)
.thatsScaled(1.9,2.9)
.thatsFilledWith(color3)
.thatsStrokeColored(brown)
.thatsTranslated(330,-320),
cloth1
.thatsScaled(0.7,0.9)
.thatsStrokeColored(brown)
.thatsStrokeSized(4)
.thatsTranslated(40,10),
cloth1
.thatsStrokeColored(brown)
.thatsStrokeSized(4)
.thatsRotated(20)
.thatsTranslated(50,-35),
cloth1
.thatsStrokeColored(brown)
.thatsStrokeSized(4)
.thatsRotated(40)
.thatsTranslated(115,-50),
cloth1
.thatsStrokeColored(brown)
.thatsStrokeSized(4)
.thatsRotated(60)
.thatsScaled(0.8,0.9)
.thatsTranslated(155,-10),
cloth1
.thatsStrokeColored(brown)
.thatsStrokeSized(4)
.thatsRotated(22)
.thatsScaled(1.2,0.7)
.thatsTranslated(55,14),
Chain
.thatsRotated(13)
.thatsTranslated(86, 110),
pot
.thatsFilledWith(Color(255, 190, 0))
.thatsTranslated(110, 15)
.thatsRotated(30),
leaf
.thatsFilledWith(colors2)
.thatsRotated(-25)
.thatsScaled(1.9,1.4)
.thatsTranslated(100, 65),
leaf
.thatsFilledWith(colors2)
.thatsRotated(-45)
.thatsScaled(1.9,1.4)
.thatsTranslated(76, 76)
)
gudi.thatsTranslated(75, 0).draw
oval
.thatsStrokeColored(blue)
.thatsStrokeSized(5)
.thatsScaled(1.0,1.0)
.thatsTranslated(-170, -147).draw
oval2
.thatsFilledWith(Color(51, 0, 204))
.thatsStrokeColored(green)
.thatsStrokeSized(4)
.thatsScaled(1.0,1.11)
.thatsTranslated(-170, -145).draw
def chakri = picStack(
round
.thatsScaled(0.5,0.5),
round
.thatsScaled(0.9,0.9),
round
.thatsScaled(1.4,1.4)
)
def lamp = Picture.fromPath { x =>
x.moveTo(0,0)
x.arc(-30, 0, -80)
x.arc(30,0,180)
x.arc(0, 0, -90)
}
def diyas = picStack(
lamp
.thatsFilledWith(color4)
.thatsTranslated(-400, -140),
lamp
.thatsFilledWith(color4)
.thatsRotated(10)
.thatsTranslated(-330, -33),
lamp
.thatsFilledWith(color4)
.thatsTranslated(60, -133),
lamp
.thatsFilledWith(color4)
.thatsRotated(-10)
.thatsTranslated(-15, -33),
lamp
.thatsFilledWith(color4)
.thatsTranslated(-170, -10),
lamp
.thatsFilledWith(color4)
.thatsTranslated(-165, -275),
lamp
.thatsFilledWith(color4)
.thatsRotated(-10)
.thatsTranslated(-310, -245),
lamp
.thatsFilledWith(color4)
.thatsRotated(10)
.thatsTranslated(-23, -245)
)
diyas.draw
}
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-100, -75).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-155, -70).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-209, -70).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-260, -74).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-313, -95).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(180)
.thatsTranslated(-330, -140).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(200)
.thatsTranslated(-312, -195).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(70)
.thatsTranslated(-255, -215).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-210, -225).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-159, -225).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-110, -225).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(90)
.thatsTranslated(-56, -210).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(155)
.thatsTranslated(-15, -169).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(155)
.thatsTranslated(-12, -119).draw
round
.thatsScaled(1.0,0.4)
.thatsFilledWith(green)
.thatsRotated(55)
.thatsTranslated(-49, -89).draw
def chakri = picStack(
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(40)
.thatsTranslated(-316, -120),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(15)
.thatsTranslated(-270, -99),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsTranslated(-220, -89),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsTranslated(-170, -85),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsTranslated(-120, -87),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsTranslated(-69, -93),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsTranslated(-25, -112),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-59)
.thatsTranslated(-10, -155),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-150)
.thatsTranslated(-45, -187),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-160)
.thatsTranslated(-95, -201),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-170)
.thatsTranslated(-145, -209),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-170)
.thatsTranslated(-195, -209),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-170)
.thatsTranslated(-240, -204),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-183)
.thatsTranslated(-285, -190),
shape2
.thatsScaled(0.4,0.3)
.thatsStrokeColored(purple)
.thatsStrokeSized(15)
.thatsRotated(-220)
.thatsTranslated(-325, -158),
)
chakri.thatsFilledWith(red).draw
def round2 = Picture.circle(50)
def flower = picStack(
round2,
round2
.thatsRotated(45)
.thatsTranslated(75, 60),
round2
.thatsRotated(45)
.thatsTranslated(40, -90),
round2
.thatsRotated(45)
.thatsTranslated(155, 9),
round2
.thatsRotated(45)
.thatsTranslated(130, -80),
round2
.thatsStrokeColored(yellow)
.thatsRotated(45)
.thatsTranslated(76, -25)
)
flower
.thatsFilledWith(color6)
.thatsStrokeColored(color4)
.thatsStrokeSized(15)
.thatsScaled(0.9999,0.3)
.thatsTranslated(-250, -140)
.draw
round
.thatsFilledWith(gradients)
.thatsScaled(4.9,1.3)
.thatsTranslated(-175, -148)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-400, -140)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-330, -33)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(60, -133)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-15, -33)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-170, -10)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-165, -275)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-310, -245)
.draw
flame2
.thatsScaled(scale/90.0)
.thatsFilledWith(color5)
.thatsTranslated(-23, -245)
.draw
def nextScale = scale+increment
(nextScale,increment)
}
flame2.draw