Code Sketch
Thanjavur Dancing Dolls
Category: Art
// "A special thank you to Sir Lalit Pant and Sir Anay Kamat"
/* Thanjavur dolls, also known as Thanjavur Bommai or Tanjore dolls,
are a traditional form of South Indian art and craftsmanship originating
from the city of Thanjavur (also known as Tanjore) in Tamil Nadu, India.
They are part of the rich cultural heritage of Tamil Nadu.These dolls
are typically made of terracotta and are known for their exquisite
craftsmanship, vibrant colors, and intricate detailing. */
// #include /music.kojo
cleari
import net.kogics.kojo.music.Duration._
val notes = Phrase(
f4, f4, g4, f4,
d4, d4, g4, f4,
d4, e4, c4, d4,
f4, f4, f4, f4, r_h,
f4, f4, g4, f4,
d4, d4, g4, f4,
d4, e4, c4, d4,
f4, f4, f4, f4, r_h,
b4, b4, c5, b4,
c5, b4, c5, b4,
c5, d5, c5, b4,
a4, a4, r_h,
g4, g4, b4, b4,
c5, b4, c5, b4,
c5, e5, d5, b4,
a4, a4, r_h,
g4, g4, a4, g4,
e4, r_h, fs4,
fs4, d4, e4, g4, r_h,
g4, g4, a4, g4,
e4, r_h, fs4, fs4,
d4, e4, g4, r_h,
)
val score =
Score(
250.0,
InstrumentPart(Instrument.ACCORDION, notes),
InstrumentPart(Instrument.ALTO_SAXOPHONE, notes),
InstrumentPart(Instrument.GLOCKENSPIEL, notes),
InstrumentPart(Instrument.WOODBLOCKS, notes),
)
setBackground(gradient9)
def animatedThanjavurMale(state: Seq[Double]): Picture =
picStack(
body2Male.thatsScaled(0.9).thatsTranslated(state(0), state(1)),
body1Male.thatsScaled(0.9).thatsTranslated(-state(0), state(1)),
headMale.thatsScaled(0.9).thatsTranslated(state(0), state(1))
).withZIndex(1)
def keyframes = KeyFrames(
0 -> Seq(-3, 0),
25 -> Seq(0, 0),
50 -> Seq(3, 0),
75 -> Seq(0, 0),
100 -> Seq(-3, 0),
)
def maleAnimation = Timeline(
1,
keyframes,
easing.Linear,
animatedThanjavurMale,
true
).repeatedForever
def keyframes4 = KeyFrames(
0 -> Seq(0, 0),
25 -> Seq(0, 0),
50 -> Seq(0, 0),
75 -> Seq(0, 0),
100 -> Seq(0, 0),
)
def animation = Timeline(
10.04,
keyframes4,
easing.Linear,
animatedThanjavurMale,
true
)
run(animation)
def animatedThanjavurFemale(states: Seq[Double]): Picture = picStack(
body2Female.thatsScaled(0.9).thatsTranslated(3.0 * cos(states(0)), 0),
body1Female.thatsScaled(0.9).thatsTranslated(3.0 * sin(states(0)), 0),
headFemale.thatsScaled(0.9).thatsTranslated(3.0 * cos(states(0)), 0)
).withZIndex(1)
def durationOfEntireAnimation: Double = 1.0
def initialStates: Seq[Double] = Seq(0)
def finalStates: Seq[Double] = Seq(360)
def femaleAnimation = Transition(
durationOfEntireAnimation,
initialStates,
finalStates,
easing.Linear,
animatedThanjavurFemale,
true
).repeatedForever
def animatedThanjavurFemale1(states: Seq[Double]): Picture = picStack(
body2Female.thatsScaled(0.9).thatsTranslated(0 * cos(states(0)), 0),
body1Female.thatsScaled(0.9).thatsTranslated(0 * sin(states(0)), 0),
headFemale.thatsScaled(0.9).thatsTranslated(0 * cos(states(0)), 0)
).withZIndex(1)
def durationOfEntireAnimation1: Double = 10.06
def initialStates1: Seq[Double] = Seq(0)
def finalStates1: Seq[Double] = Seq(360)
def animation1 = Transition(
durationOfEntireAnimation1,
initialStates1,
finalStates1,
easing.Linear,
animatedThanjavurFemale1,
true
)
run(animation1)
def sin(angleInDegrees: Double): Double = Math.sin(angleInDegrees.toRadians)
def cos(angleInDegrees: Double): Double = Math.cos(angleInDegrees.toRadians)
def body2Female = picStack(
picStack(
picStack(
picStack(
skirt.thatsFilledWith(gradient2).thatsStrokeColored(noColor),
pallu2.thatsStrokeColored(gradient1).thatsFilledWith(gradient1).thatsStrokeSized(8)),
picStack(
skBorder.thatsStrokeSized(20).thatsStrokeColored(gradient8),
pallu2Border.thatsStrokeSized(12).thatsStrokeColored(gradient8))),
picStack(
picStack(
design1.thatsStrokeColored(gradient8).thatsFilledWith(gradient8),
circle.thatsStrokeColored(orange).thatsFilledWith(orange).thatsScaled(4.5).thatsTranslated(20, -95)),
picStack(
circle.thatsStrokeColored(yellow).thatsFilledWith(orange).thatsScaled(3.5).thatsTranslated(20, -95),
circle.thatsStrokeColored(Color(255, 153, 102)).thatsFilledWith(orange).thatsScaled(1.5).thatsTranslated(20, -95))))).thatsTranslated(150, -25)
def body1Female = picStack(
picStack(
square.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(60, 14),
body.thatsStrokeColored(gradient2).thatsFilledWith(gradient2)),
picStack(
picStack(
picStack(
neck.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)),
pallu1.thatsStrokeColored(gradient1).thatsFilledWith(gradient1)),
picStack(
necklace2,
leftHand1)),
picStack(
picStack(
rightHand.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsRotated(-170).thatsTranslated(-56, 50).thatsScaled(0.9),
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(20).thatsTranslated(70, -45)),
picStack(
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(17).thatsTranslated(77, -48),
circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(2.5).thatsTranslated(72, -1))))).thatsTranslated(150, -25)
def headFemale = picStack(
crown.thatsFilledWith(gradient).thatsStrokeColored(yellow).thatsStrokeSized(2).thatsTranslated(0, 25),
picStack(
picStack(
picStack(
picStack(
rightEar.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(-2, 0),
leftEar.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(-2, 0)),
picStack(
face.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(0, 145),
hair.thatsFilledWith(brown).thatsStrokeColored(brown).thatsTranslated(0, 155))),
picStack(
picStack(
leftEyeB.thatsStrokeColored(brown).thatsStrokeSized(4).thatsTranslated(3, 0),
rightEyeB.thatsStrokeSized(4).thatsTranslated(-6, 0)),
picStack(
leftEye.thatsStrokeSized(3).thatsFilledWith(white).thatsStrokeColored(brown).thatsTranslated(3, 0),
rightEye.thatsStrokeSized(3).thatsFilledWith(white).thatsStrokeColored(brown).thatsTranslated(-6, 0)))),
picStack(
picStack(
picStack(
circle.thatsStrokeColored(black).thatsFilledWith(black).thatsTranslated(-24, 188),
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5).thatsTranslated(-50, 170)),
picStack(
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5, 1.8).thatsTranslated(-49, 160),
lips.thatsFilledWith(Color(164, 0, 0)))),
picStack(
picStack(
nose.thatsFilledWith(Color(245, 223, 170)).thatsStrokeColored(noColor),
circle.thatsStrokeColored(black).thatsFilledWith(black).thatsTranslated(21, 188)),
picStack(
circle.thatsStrokeColored(red).thatsFilledWith(red).thatsTranslated(0, 200),
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5).thatsTranslated(48, 170),
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5, 1.8).thatsTranslated(47, 160)))))).thatsTranslated(150, -25)
def body2Male = picStack(
picStack(
skirt.thatsFilledWith(Color(236, 255, 255)).thatsStrokeColored(noColor),
pallu2b.thatsStrokeColored(gradient5).thatsFilledWith(gradient5).thatsStrokeSized(8)),
picStack(
picStack(
picStack(
skBorder.thatsStrokeSized(9).thatsStrokeColored(yellow),
skBorder.thatsStrokeSized(12).thatsStrokeColored(orange).thatsTranslated(0, 15)),
picStack(
skBorder.thatsStrokeSized(9).thatsStrokeColored(yellow).thatsTranslated(0, 30),
design3.thatsTranslated(0, -50))),
picStack(
picStack(
design3,
pallu2bBorder.thatsStrokeSized(12).thatsStrokeColored(gradient8)),
picStack(
circle.thatsStrokeColored(orange).thatsFilledWith(orange).thatsScaled(4.5).thatsTranslated(0, -95),
circle.thatsStrokeColored(yellow).thatsFilledWith(orange).thatsScaled(3.5).thatsTranslated(0, -95)),
circle.thatsStrokeColored(Color(255, 153, 102)).thatsFilledWith(orange).thatsScaled(1.5).thatsTranslated(0, -95)))).thatsTranslated(-150, -25)
def body1Male = picStack(
picStack(
picStack(
square.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(60, 14),
neck.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117))),
picStack(
picStack(
body4.thatsStrokeColored(gradient6).thatsFilledWith(gradient6),
necklace3.thatsFilledWith(gradient8).thatsStrokeColored(gradient6).thatsStrokeSized(3)),
picStack(
necklace3.thatsFilledWith(gradient8).thatsStrokeColored(gradient6).thatsStrokeSized(3).thatsTranslated(0, -10),
necklace3.thatsFilledWith(gradient8).thatsStrokeColored(gradient6).thatsStrokeSized(3).thatsTranslated(0, -20)))),
picStack(
picStack(
picStack(
necklace3.thatsFilledWith(gradient8).thatsStrokeColored(gradient6).thatsStrokeSized(3).thatsTranslated(0, -30),
necklace3.thatsFilledWith(gradient8).thatsStrokeColored(gradient6).thatsStrokeSized(3).thatsTranslated(0, -40)),
picStack(
skBorder.thatsScaled(0.35, 1).thatsStrokeSized(9).thatsStrokeColored(yellow).thatsTranslated(0, 237),
skBorder.thatsRotated(93).thatsScaled(1.3, 0.6).thatsStrokeSized(9).thatsStrokeColored(gradient8).thatsTranslated(-360, 42),
skBorder.thatsRotated(-93).thatsScaled(1.3, 0.6).thatsStrokeSized(9).thatsStrokeColored(gradient8).thatsTranslated(360, 42),
skBorder.thatsRotated(75).thatsScaled(1.3, 0.6).thatsStrokeSized(9).thatsStrokeColored(gradient8).thatsTranslated(-306, 90),
skBorder.thatsRotated(-75).thatsScaled(1.3, 0.6).thatsStrokeSized(9).thatsStrokeColored(gradient8).thatsTranslated(306, 90))),
picStack(
picStack(
leftHand1,
rightHand.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsRotated(-170).thatsTranslated(-57, 50).thatsScaled(0.9)),
picStack(
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(20).thatsTranslated(70, -45),
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(17).thatsTranslated(77, -48),
circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(2.5).thatsTranslated(72, -1))))).thatsTranslated(-150, -25)
def headMale = picStack(
picStack(
rightEar.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(-2, 0),
leftEar.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(-2, 0)),
picStack(
picStack(
picStack(
picStack(
face.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsTranslated(0, 145),
design3.thatsRotated(180).thatsScaled(1.5, 1).thatsTranslated(0, 145)),
picStack(
turban.thatsFilledWith(gradient5).thatsStrokeColored(gradient).thatsTranslated(0, 25),
leftEyeB.thatsStrokeColored(brown).thatsStrokeSized(4).thatsTranslated(3, 0))),
picStack(
picStack(
rightEyeB.thatsStrokeSized(4).thatsTranslated(-6, 0),
leftEye.thatsStrokeSized(3).thatsFilledWith(white).thatsStrokeColored(brown).thatsTranslated(3, 0)),
picStack(
rightEye.thatsStrokeSized(3).thatsFilledWith(white).thatsStrokeColored(brown).thatsTranslated(-6, 0),
circle.thatsStrokeColored(black).thatsFilledWith(black).thatsTranslated(-24, 188)))),
picStack(
picStack(
picStack(
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5).thatsTranslated(-50, 170),
lips.thatsFilledWith(Color(255, 153, 153)).thatsStrokeColored(Color(255, 153, 153))),
picStack(
nose.thatsFilledWith(Color(245, 223, 170)).thatsStrokeColored(noColor),
circle.thatsStrokeColored(black).thatsFilledWith(black).thatsTranslated(21, 188))),
picStack(
picStack(
circle.thatsStrokeColored(orange).thatsFilledWith(yellow).thatsScaled(1.5).thatsTranslated(48, 170),
muchtache.thatsStrokeColored(black).thatsFilledWith(black).thatsScaled(0.7).thatsTranslated(0, 160)),
picStack(
muchtache.withFlippedX.thatsStrokeColored(black).thatsFilledWith(black).thatsScaled(0.7).thatsTranslated(0, 160),
tilak.thatsFilledWith(red).thatsScaled(0.7, 0.7).thatsTranslated(0, 195)))))).thatsTranslated(-150, -25)
def gradient = cm.radialMultipleGradient(
0, 230,
90,
Seq(0, 0.3, 1),
Seq(Color(255, 32, 15), orange, yellow),
false
)
def gradient1 =
cm.linearGradient(
-40, 0,
Color(153, 0, 51),
-80, 0,
Color(255, 51, 0),
true
)
def gradient2 =
cm.linearGradient(
20, 0,
Color(0, 204, 0),
80, 0,
Color(51, 102, 0),
true
)
def gradient3 =
cm.linearGradient(
110, 0,
Color(255, 255, 204),
170, 0,
Color(0, 102, 0),
true
)
def gradient4 =
cm.linearGradient(
0, -67,
Color(51, 204, 0),
0, 100,
Color(102, 255, 255),
false
)
def gradient5 =
cm.linearGradient(
-40, 200,
Color(255, 32, 15),
-80, 190,
orange,
true
)
def gradient6 =
cm.linearGradient(
-40, 200,
Color(51, 255, 255),
-80, 190,
blue,
true
)
def gradient8 =
cm.linearGradient(
-40, 200,
Color(255, 204, 0),
-80, 190,
Color(255, 255, 102),
true
)
def gradient9 =
cm.linearGradient(
0, -250,
Color(102, 0, 102),
0, -270,
Color(102, 0, 0),
false
)
def necklace = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-30, 110)
x.bezierVertex(
-10, 90,
10, 90,
29, 110
)
x.bezierVertex(
15, 80,
-15, 80,
-30, 110
)
x.bezierVertex(
-40, 80,
-30, 40,
0, 10
)
x.bezierVertex(
30, 40,
40, 80,
30, 110
)
x.bezierVertex(
25, 70,
25, 50,
0, 13
)
x.bezierVertex(
-25, 50,
-25, 70,
-30, 110
)
x.endShape()
}
def necklace3 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-30, 110)
x.bezierVertex(
-10, 90,
10, 90,
29, 110
)
x.bezierVertex(
15, 80,
-15, 80,
-30, 110
)
x.endShape()
}
def body: Picture = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(30, 110)
x.bezierVertex(
85, 90,
75, 80,
85, 30
)
x.bezierVertex(
55, 25,
55, 25,
55, 25
)
x.bezierVertex(
45, 70,
30, -10,
30, -10
)
x.bezierVertex(
0, -20,
-30, -10,
-30, -10
)
x.bezierVertex(
-30, -10,
-45, 70,
-55, 25
)
x.bezierVertex(
-60, 25,
-60, 25,
-80, 35
)
x.bezierVertex(
-75, 80,
-85, 90,
-30, 110
)
x.endShape()
}
def body4: Picture = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(30, 110)
x.bezierVertex(
88, 99,
75, 80,
85, 30
)
x.bezierVertex(
55, 25,
55, 25,
55, 25
)
x.bezierVertex(
45, 70,
30, -10,
30, -10
)
x.bezierVertex(
0, -20,
-30, -10,
-30, -10
)
x.bezierVertex(
-30, -10,
-45, 70,
-55, 25
)
x.bezierVertex(
-60, 25,
-60, 25,
-80, 35
)
x.bezierVertex(
-75, 90,
-85, 95,
-30, 110
)
x.bezierVertex(
-6, 100,
6, 100,
30, 110)
x.endShape()
}
def skirt: Picture = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-28, -20)
x.bezierVertex(
-1, 20,
-1, 20,
-1, 20
)
x.bezierVertex(
1, 20,
1, 20,
28, -20
)
x.bezierVertex(
80, -80,
80, -90,
100, -250)
x.bezierVertex(
0, -265,
0, -265,
-100, -250
)
x.bezierVertex(
-85, -90,
-85, -90,
-28, -21
)
x.endShape()
}
def crown = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-55, 170)
x.bezierVertex(
-50, 220,
-45, 220,
0, 260
)
x.bezierVertex(
45, 220,
45, 220,
50, 170
)
x.bezierVertex(
0, 225,
0, 225,
-55, 175
)
x.endShape()
}
def turban = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-55, 170)
x.bezierVertex(
-80, 240,
-45, 230,
10, 230
)
x.bezierVertex(
60, 210,
10, 200,
-55, 170
)
x.endShape()
x.beginShape()
x.vertex(0, 200)
x.bezierVertex(
-17, 230,
75, 260,
50, 170
)
x.endShape()
}
def leftHand: Picture = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-102, 80)
x.bezierVertex(
-110, 50,
-150, 30,
-145, 100
)
x.bezierVertex(
-135, 120,
-135, 90,
-135, 90
)
x.bezierVertex(
-135, 140,
-100, 140,
-110, 90
)
x.bezierVertex(
-100, 100,
-90, 100,
-102, 80
)
x.endShape()
x.beginShape()
x.vertex(-127, 52)
x.bezierVertex(
-110, 40,
-107, 35,
-93, 60
)
x.bezierVertex(
-105, 70,
-105, 70,
-105, 70
)
x.bezierVertex(
-120, 52,
-127, 52,
-127, 52)
x.endShape()
}
def lineOne = Picture.line(5, 20)
def leftHand1 = picStack(
picStack(
leftHand.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)).thatsRotated(20).thatsTranslated(46, 2).thatsScaled(0.9),
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(25).thatsTranslated(-96, 50)),
picStack(
lineOne.thatsStrokeColored(Color(242, 193, 117)).thatsRotated(25).thatsTranslated(-89, 51),
circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(2.5).thatsTranslated(-88, 25))
)
def rightHand: Picture = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-102, 80)
x.bezierVertex(
-110, 50,
-150, 30,
-145, 100
)
x.bezierVertex(
-135, 120,
-135, 90,
-135, 90
)
x.bezierVertex(
-135, 140,
-100, 140,
-110, 90
)
x.bezierVertex(
-100, 100,
-90, 100,
-102, 80
)
x.endShape()
}
def necklace2 = picStack(
necklace.thatsFilledWith(gradient8).thatsStrokeColored(orange), circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(1.9).thatsTranslated(0, 2))
def pallu2 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-28, -20)
x.bezierVertex(
-1, 20,
-1, 20,
-1, 20
)
x.bezierVertex(
1, 20,
1, 20,
28, -20
)
x.bezierVertex(
80, -80,
77, -90,
77, -90)
x.bezierVertex(
87, -90,
47, -140,
27, -90
)
x.bezierVertex(
-37, -130,
-67, -130,
-75, -90
)
x.bezierVertex(
-30, -15,
-30, -18,
-28, -20
)
x.endShape()
}
def pallu2b = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-28, -20)
x.bezierVertex(
-1, 20,
-1, 20,
-1, 20
)
x.bezierVertex(
1, 20,
1, 20,
28, -20
)
x.bezierVertex(
80, -80,
77, -90,
77, -90)
x.bezierVertex(
87, -90,
47, -140,
0, -90
)
x.bezierVertex(
-37, -120,
-67, -120,
-75, -90
)
x.bezierVertex(
-27, -15,
-27, -18,
-26, -18
)
x.endShape()
}
def pallu2Border = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-77, -90)
x.bezierVertex(
-67, -130,
-37, -130,
23, -90
)
x.bezierVertex(
50, -125,
60, -120,
80, -94
)
x.endShape()
}
def pallu2bBorder = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-77, -90)
x.bezierVertex(
-60, -120,
-39, -120,
5, -94
)
x.bezierVertex(
50, -125,
60, -120,
80, -94
)
x.endShape()
}
def skBorder = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-95, -250)
x.bezierVertex(
0, -257,
0, -257,
95, -250
)
x.endShape()
}
def design1 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(20, -95)
x.bezierVertex(
6, -150,
6, -200,
20, -170
)
x.bezierVertex(
25, -195,
35, -195,
35, -170
)
x.bezierVertex(
48, -185,
55, -185,
20, -95
)
x.endShape()
}
def design2 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(5, -100)
x.bezierVertex(
-65, -120,
5, -160,
5, -160
)
x.bezierVertex(
5, -160,
65, -120,
5, -100
)
x.endShape()
}
def design3 = picStack(
picStack(
design2.thatsFilledWith(gradient5).thatsStrokeSized(7).thatsStrokeColored(yellow),
lineOne.thatsStrokeColored(gradient5).thatsScaled(1.9).thatsTranslated(-12, -140)),
picStack(
lineOne.thatsScaled(1.9).thatsTranslated(-20, -140).withFlippedX,
lineOne.thatsScaled(2.3).thatsRotated(15).thatsTranslated(5, -149))
)
def pallu1 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(30, 110)
x.bezierVertex(
-40, 50,
-50, 40,
-30, -10
)
x.bezierVertex(
0, -18,
0, -18,
30, -10
)
x.bezierVertex(
80, 90,
60, 105,
30, 110
)
x.endShape()
}
def muchtache = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(0, 0)
x.bezierVertex(
20, 20,
45, -20,
50, 4
)
x.bezierVertex(
55, -20,
20, -6,
0, 0
)
x.endShape()
}
def square = Picture.rect(25, 23)
def circle = Picture.circle(3)
def face = Picture.fromPath {
x =>
x.moveTo(-35, 8)
x.lineTo(-55, 50)
x.arc(50, 50, -120)
x.lineTo(35, 8)
x.arc(-35, 8, -90)
x.closePath()
}
def hair = Picture.fromPath {
x =>
x.moveTo(-55, 37)
x.lineTo(0, 70)
x.lineTo(50, 38)
x.arc(-55, 37, 160)
}
def leftEyeB = Picture.fromPath {
x =>
x.moveTo(-40, 195)
x.arc(-15, 195, -70)
}
def rightEyeB = leftEyeB.withFlippedX.thatsStrokeColored(brown)
def leftEye = Picture.fromPath {
x =>
x.moveTo(-38, 188)
x.arc(-15, 188, -70)
x.arc(-38, 188, -70)
}
def rightEye = leftEye.withFlippedX
def nose = Picture.fromPath {
x =>
x.moveTo(-2, 185)
x.lineTo(-6, 170)
x.arc(6, 170, 80)
x.lineTo(2, 185)
x.closePath()
}
def lips = Picture.fromPath {
x =>
x.moveTo(-12, 155)
x.arc(0, 155, -90)
x.arc(12, 155, -90)
x.arc(-12, 155, -90)
}
def leftEar = Picture.fromPath {
x =>
x.moveTo(-50, 188)
x.arc(-59, 190, 100)
x.arc(-40, 168, 100)
}
def rightEar = leftEar.withFlippedX
def neck: Picture = Picture.fromPath {
x =>
x.moveTo(-12, 145)
x.arc(12, 145, -40)
x.lineTo(14, 120)
x.lineTo(30, 110)
x.arc(-30, 110, -125)
x.lineTo(-14, 120)
x.lineTo(-12, 145)
}
def leg = Picture.fromPath {
x =>
x.moveTo(160, -250)
x.arc(170, -285, -40)
x.arc(165, -284, -100)
x.arc(160, -284, -90)
x.arc(155, -284, -90)
x.arc(150, -284, -90)
x.arc(145, -284, -90)
x.arc(135, -250, -50)
x.lineTo(130, -250)
x.arc(125, -285, -50)
x.arc(120, -284, -100)
x.arc(115, -284, -90)
x.arc(110, -284, -90)
x.arc(105, -284, -90)
x.arc(100, -284, -90)
x.arc(108, -250, -50)
x.lineTo(160, -250)
}
def shoe = Picture.fromPath {
x =>
x.moveTo(170, -269)
x.arc(170, -285, -40)
x.arc(145, -285, -40)
x.arc(140, -270, -40)
x.arc(170, -269, 40)
}
def stand1 = picStack(
picStack(
oval1.thatsScaled(1.8, 2.0).thatsFilledWith(blue).thatsStrokeColored(blue).thatsTranslated(135, -300),
oval1.thatsScaled(1.6, 2.0).thatsFilledWith(green).thatsStrokeColored(green).thatsTranslated(135, -289)),
picStack(
oval1.thatsScaled(1.4, 1.5).thatsFilledWith(Color(255, 25, 13)).thatsStrokeColored(yellow).thatsTranslated(135, -280),
legs1)
)
def legs1 = picStack(
leg.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117)),
picStack(
picStack(
picStack(
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(102, -283),
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(107, -283)),
picStack(
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(112, -283),
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(117, -283))),
picStack(
picStack(
picStack(
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(123, -283),
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(147, -283)),
picStack(
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(152, -283),
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(157, -283))),
picStack(
picStack(
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(162, -283),
circle.thatsFilledWith(red).thatsScaled(0.5).thatsTranslated(168, -283)),
picStack(
circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(1.8).thatsTranslated(153, -270),
circle.thatsStrokeColored(orange).thatsFilledWith(red).thatsScaled(1.8).thatsTranslated(115, -270))))))
stand1.draw
def stand2 = picStack(
picStack(
oval1.thatsScaled(1.8, 2.0).thatsFilledWith(blue).thatsStrokeColored(blue).thatsTranslated(135, -300),
oval1.thatsScaled(1.6, 2.0).thatsFilledWith(green).thatsStrokeColored(green).thatsTranslated(135, -289)),
picStack(
picStack(
oval1.thatsScaled(1.4, 1.5).thatsFilledWith(Color(255, 25, 13)).thatsStrokeColored(yellow).thatsTranslated(135, -280),
leg.thatsFilledWith(Color(255, 244, 218)).thatsStrokeColored(Color(242, 193, 117))),
picStack(
shoe.thatsFilledWith(Color(51, 0, 204)).thatsStrokeColored(Color(51, 0, 204)).thatsScaled(1.1).thatsTranslated(-17, 28),
shoe.thatsFilledWith(Color(51, 0, 204)).thatsStrokeColored(Color(51, 0, 204)).thatsScaled(1.1).withFlippedX.thatsTranslated(286, 28))))
stand2.thatsTranslated(-270, 0).draw
def oval1 = Picture.ellipse(40, 10)
def shape = Picture.fromPath {
x =>
x.moveTo(0, 0)
x.curveTo(
-5, 1,
-1, 20,
0, 25
)
}
def tilak = picStack(
shape,
shape.withFlippedX
)
def arc1 = Picture.fromPath {
x =>
x.moveTo(-300, 0)
x.arc(-100, 0, 90)
x.arc(100, 0, 90)
x.arc(300, 0, 90)
x.arc(500, 0, 90)
x.arc(700, 0, 90)
x.closePath()
}
def arc2 = Picture.fromPath {
x =>
x.moveTo(-200, 200)
x.arc(-200, 0, -150)
x.closePath()
}
def arc3 = Picture.fromPath {
x =>
x.moveTo(-390, -40)
x.arc(-490, 30, 90)
}
def sideCurtain = picStack(
picStack(
picStack(
square2.thatsFilledWith(gradient1).thatsTranslated(-500, -310),
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1, 1.5).thatsRotated(-10).thatsTranslated(-255, -50)),
picStack(
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1, 1.5).thatsRotated(-9).thatsTranslated(-281, -40),
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1.2, 1.5).thatsRotated(-4).thatsTranslated(-244, -30))),
picStack(
picStack(
picStack(
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1, 1.9).thatsRotated(7).thatsTranslated(-217, -320),
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1, 1.9).thatsRotated(7).thatsTranslated(-237, -320)),
picStack(
arc2.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsScaled(1, 1.9).thatsRotated(7).thatsTranslated(-257, -320),
arc3.thatsStrokeColored(gradient8).thatsStrokeSized(8))),
picStack(
picStack(
lineOne.thatsStrokeColored(gradient8).thatsStrokeSized(8).thatsRotated(45).thatsScaled(1, 2.9).thatsTranslated(-379, -99),
arc3.thatsStrokeColored(gradient8).thatsStrokeSized(8).thatsTranslated(0, -15)),
picStack(
circle.thatsScaled(3).thatsFilledWith(red).thatsTranslated(-394, -30),
circle.thatsScaled(2).thatsFilledWith(yellow).thatsTranslated(-394, -30))))
)
def curtains = picStack(
sideCurtain.thatsScaled(0.9, 1).thatsTranslated(-50, 0),
topCurtain
)
def square2 = Picture.rect(620, 80)
curtains.draw
curtains.withFlippedX.draw
def topCurtain = picStack(
arc1.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsTranslated(-210, 307),
arc1.thatsFilledWith(gradient1).thatsStrokeColored(gradient1).thatsTranslated(-100, 307)
)
def square3 = Picture.rect(660, 500)
def animatedcurtain(state: Seq[Double]): Picture = square3.thatsFilledWith(gradient1).thatsTranslated(0, -350).thatsTranslated(state(0), state(1)).withZIndex(2)
def keyframes2 = KeyFrames(
0 -> Seq(-500, 0),
25 -> Seq(-600, 0),
50 -> Seq(-700, 0),
75 -> Seq(-800, 0),
100 -> Seq(-1000, 0),
)
def leftCurtainOpen = Timeline(
10,
keyframes2,
easing.Linear,
animatedcurtain,
true)
def keyframes3 = KeyFrames(
0 -> Seq(0, 0),
25 -> Seq(100, 0),
50 -> Seq(200, 0),
75 -> Seq(300, 0),
100 -> Seq(500, 0),
)
def rightCurtainOpen = Timeline(
10,
keyframes3,
easing.Linear,
animatedcurtain,
true)
def openCurtains = animPar(leftCurtainOpen, rightCurtainOpen)
def dollAnimation = animPar(maleAnimation, femaleAnimation)
val showFlickerSolution = false
def finalAnimation = if (showFlickerSolution) {
animPar(openCurtains, dollAnimation)
}
else {
animSeq(openCurtains, dollAnimation)
}
val musicPause = if (showFlickerSolution) 0 else 9.5
//MusicPlayer.startAsNeeded()
run(finalAnimation)
pause(musicPause)
MusicPlayer.play(score)