Code Sketch
Happy Birthday
Category: Art
cleari
setBackground(colors)
def line1 = Picture.line(90, 0)
def square1 = Picture.rect(25, 15)
def box = Picture.rect(45, 100)
def ch1 = Picture.arc(20, 80)
def round = Picture.circle(50)
def ovalOne = Picture.ellipse(300, 90)
def ovalTwo = Picture.ellipse(100, 40)
def arcOne = Picture.arc(200, 77)
def arcTwo = Picture.fromPath {
x =>
x.moveTo(300,0)
x.arc(300,-250,40)
x.arc(200, -250, -40)
x.arc(100, -250, -40)
x.arc(0, -250, -40)
x.arc(-100, -250, -40)
x.arc(-200, -250, -40)
x.arc(-300, -250, -40)
x.arc(-300,0,40)
x.arc(300, 0, 51)
x.closePath()
}
def arcThree = Picture.fromPath {
x =>
x.moveTo(-300, 0)
x.arc(-100, -60, 80)
x.arc(100, -60, 80)
x.arc(300, 0, 80)
x.arc(-300, 0, -50)
x.closePath()
}
def arcFour = Picture.fromPath {
x =>
x.moveTo(0, 10)
x.arc(-50, 20, 40)
x.arc(-50, -20, 40)
x.arc(0, -10, 40)
x.arc(0, 10, 40)
x.moveTo(-55, 10)
x.arc(-75, 10, 40)
x.arc(-75, -25, 40)
x.arc(0, -10, 40)
x.arc(-50, -10, 25)
x.moveTo(0, 0)
x.arc(-50, -150, 10)
x.arc(-25, -120, 15)
x.arc(-15, -150, 15)
x.arc(0, 0, 15)
x.closePath()
}
def arcFive = Picture.fromPath {
x =>
x.moveTo(300,-250)
x.arc(200, -250, -80)
x.arc(100, -250, -80)
x.arc(0, -250, -80)
x.arc(-100, -250, -80)
x.arc(-200, -250, -80)
x.arc(-300, -250, -80)
}
def arcSix = Picture.fromPath {
x =>
x.moveTo(-300, 0)
x.arc(-300, -200, -25)
x.arc(300, -200, 35)
x.arc(300, 0, -25)
x.closePath()
}
def arcSeven = Picture.fromPath {
x =>
x.moveTo(0, 10)
x.arc(-50, 20, 40)
x.arc(-50, -20, 40)
x.arc(0, -10, 40)
x.arc(0, 10, 40)
x.moveTo(-55, 10)
x.arc(-75, 10, 40)
x.arc(-75, -25, 40)
x.arc(0, -10, 40)
x.arc(-50, -10, 25)
x.moveTo(0, 0)
x.closePath()
}
def arcEight = Picture.fromPath {
x =>
x.moveTo(-100,0)
x.arc(-90, -100, 10)
x.arc(90, -100, 60)
x.arc(100, 0, 10)
x.closePath()
}
def arcNine = Picture.fromPath {
x =>
x.moveTo(100, 0)
x.arc(90, -40, -70)
x.arc(-90, -40, -50)
x.arc(-100, 0, -70)
x.closePath()
}
def arcTen = Picture.arc(15, 75)
banner
.thatsTranslated(-7,0)
.draw
table
.thatsStrokeColored(Color(137, 45, 137))
.thatsTranslated(0, -55)
.thatsScaled(1.5,1.0)
.draw
def darkGreen = Color(0, 102, 0)
def colors =
cm.linearGradient(
110, 0,
Color(245, 244, 236),
170, 0,
Color(222, 205, 123),
true
)
def color1 =
cm.linearMultipleGradient(
0, 35,
0,-35 ,
Seq(0,0.999,1),
Seq(Color(204, 0, 204),
Color(255, 150, 228),
Color(255, 51, 255)),
true
)
def colors2 =
cm.linearGradient(
110, 0,
darkGreen,
170, 0,
Color(153, 255, 102),
false
)
def color3 =
cm.linearGradient(
-67, 0,
Color(255, 153, 0),
100, 0,
Color(255, 255, 255),
true
)
def color4 =
cm.linearGradient(
-67, 0,
Color(255, 204, 255),
100, 0,
Color(204, 0, 204),
true
)
def color5 =
cm.linearGradient(
-67, 0,
Color(153, 0, 153),
100, 0,
Color(255, 155, 240),
true
)
def color6 =
cm.linearGradient(
-67, 0,
Color(0, 85, 0),
80, 0,
Color(255, 255, 255),
true
)
def color7 =
cm.linearGradient(
-67, 0,
Color(255, 0, 0),
74, 0,
Color(255, 255, 255),
true
)
def color8 =
cm.linearGradient(
-37, 0,
Color(255, 51, 153),
75, 0,
Color(255, 255, 255),
true
)
def color9 =
cm.linearGradient(
0, 0,
Color(51, 51, 255),
65, 0,
Color(255, 255, 255),
true
)
def color10 =
cm.linearMultipleGradient(
0, 35,
0,-35 ,
Seq(0,0.999,1),
Seq(Color(218, 116, 14),
Color(255, 169, 50),
Color(255, 204, 102)),
true
)
def colorR1 =
cm.linearGradient(
-47, 0,
Color(255, 51, 51),
-10, 0,
Color(255, 102, 102),
true
)
def colorR2 =
cm.linearGradient(
-47, 0,
Color(255, 153, 153),
-10, 0,
Color(255, 102, 102),
true
)
def colorR3 =
cm.linearGradient(
-47, 0,
Color(255, 201, 85),
-10, 0,
Color(243, 255, 7),
true
)
def colorR4 =
cm.linearGradient(
-47, 0,
Color(255, 50, 33),
-10, 0,
Color(204, 0, 51),
true
)
def colorR5 =
cm.linearGradient(
-47, 0,
Color(255, 0, 65),
-10, 0,
Color(204, 22, 99),
true
)
def cake1 = picStack(
arcSix,
ovalOne
)
arcFive
.thatsStrokeColored(color5)
.thatsStrokeSized(15)
.thatsScaled(1.47,1.0)
.thatsTranslated(0, -51)
.draw
def bow = picStack(
arcFour
.thatsFilledWith(color5)
.thatsScaled(1,1.6),
arcFour
.thatsFilledWith(color5)
.thatsScaled(1,1.6)
.withFlippedX,
square1
.thatsFilledWith(color5)
.thatsScaled(1,1.7)
.thatsTranslated(-8, -18)
)
def table = picStack(
ovalOne
.thatsStrokeColored(Color(153, 0, 153))
.thatsFilledWith(color1),
arcTwo
.thatsFilledWith(color4),
arcThree
.thatsFilledWith(color5),
bow
.thatsScaled(0.5,0.6)
.thatsRotated(-5)
.thatsTranslated(-103, -73),
bow
.thatsScaled(0.5,0.6)
.thatsTranslated(108, -73),
bow
.thatsScaled(0.5,0.6)
.thatsRotated(4)
.thatsTranslated(270, -36),
bow
.thatsScaled(0.5,0.6)
.thatsRotated(-01)
.thatsTranslated(-274, -32)
)
def flower = picStack(
round,
round
.thatsTranslated(75, 60),
round
.thatsTranslated(40, -90),
round
.thatsTranslated(155, 9),
round
.thatsTranslated(130, -80),
round
.thatsTranslated(76, -25)
)
def petal1 = Picture.fromPath { x =>
x.moveTo(0,0)
x.arc(-45, 10, 180)
x.arc(30, 5, 185)
x.arc(-80, -10, 200)
x.closePath()
}
def petal2 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-30, -58)
x.bezierVertex(
-30, -50,
-70, -28,
-90, -68
)
x.bezierVertex(
-80, -70,
-35, -50,
-30, -60
)
x.endShape()
}
def petal3 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(-20, -45)
x.bezierVertex(
15, 25,
25, -25,
75, -30
)
x.bezierVertex(
125, -45,
75, -70,
50, -100
)
x.endShape()
}
def arc1 = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(100, 0)
x.bezierVertex(
120, 27,
120, 27,
200, 0
)
x.endShape()
}
def arc2 = picStack(
arc1,
arc1.withFlippedY,
)
def veins = picStack(
line1
.thatsRotated(35)
.thatsScaled(0.2,0.2)
.thatsTranslated(115, 0),
line1
.thatsRotated(35)
.thatsScaled(0.2,0.2)
.thatsTranslated(130, 0),
line1
.thatsRotated(45)
.thatsScaled(0.2,0.1)
.thatsTranslated(145, 0)
)
def leaf2 = picStack(
arc2
.thatsStrokeColored(darkGreen)
.thatsFilledWith(colors2),
line1
.thatsStrokeColored(darkGreen)
.thatsTranslated(100, 0),
veins,
veins
.withFlippedY
)
def rose1 = picStack(
petal3
.thatsStrokeSized(4)
.thatsRotated(-80)
.withFlippedX
.thatsTranslated(-100,25),
petal3
.thatsStrokeSized(4)
.thatsRotated(-154)
.withFlippedY
.thatsTranslated(44,60),
petal3
.thatsStrokeSized(4)
.thatsRotated(-180)
.thatsTranslated(15,-112),
petal3
.thatsStrokeSized(4)
.thatsRotated(-80)
.thatsTranslated(75,15),
petal1
.thatsStrokeSized(5)
.thatsScaled(0.5,0.5)
.thatsRotated(180)
.withFlippedX,
petal2
.thatsStrokeSized(2)
.thatsScaled(1.0,1.9)
.thatsTranslated(34,123),
petal2
.thatsStrokeSized(2)
.thatsScaled(1.0,1.9)
.thatsRotated(-75)
.thatsTranslated(135,-20),
petal2
.thatsStrokeSized(2)
.thatsScaled(1.0,1.9)
.thatsRotated(195)
.thatsTranslated(-16,-150),
petal2
.thatsStrokeSized(2)
.thatsScaled(1.0,1.9)
.thatsRotated(100)
.thatsTranslated(-150,15)
)
def roseArr = picStack(
leaf2
.thatsRotated(47)
.thatsScaled(0.8,0.8)
.thatsTranslated(-97, -80),
leaf2
.thatsRotated(120)
.thatsScaled(0.8,0.8)
.thatsTranslated(-166, -150),
leaf2
.thatsRotated(120)
.thatsScaled(0.8,0.8)
.thatsTranslated(-255, -220),
leaf2
.thatsRotated(-100)
.thatsScaled(0.8,0.8)
.thatsTranslated(-279, -115),
leaf2
.thatsRotated(-100)
.thatsScaled(0.8,0.8)
.thatsTranslated(-170, -110),
leaf2
.thatsRotated(-100)
.thatsScaled(0.8,0.8)
.thatsTranslated(-48, -76),
rose1
.thatsFilledWith(colorR1)
.thatsStrokeColored(red)
.thatsScaled(0.7,0.7)
.thatsTranslated(-75, 30),
rose1
.thatsFilledWith(colorR1)
.thatsTranslated(43, 10)
.thatsStrokeColored(red)
.thatsTranslated(-55, -89),
rose1
.thatsFilledWith(colorR2)
.thatsStrokeColored(red)
.thatsScaled(0.8,0.8)
.thatsTranslated(-140, -40),
rose1
.thatsFilledWith(colorR4)
.thatsStrokeColored(red)
.thatsScaled(0.8,0.7)
.thatsTranslated(-130, -150),
rose1
.thatsFilledWith(colorR4)
.thatsStrokeColored(red)
.thatsScaled(0.6,0.6)
.thatsTranslated(-240, -90),
rose1
.thatsFilledWith(colorR2)
.thatsStrokeColored(red)
.thatsScaled(0.6,0.6)
.thatsTranslated(-230, -180),
rose1
.thatsFilledWith(colorR5)
.thatsStrokeColored(red)
.thatsScaled(0.7,0.7)
.thatsTranslated(-320, -160),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsRotated(45)
.thatsStrokeColored(red)
.thatsTranslated(-200, -125),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsRotated(45)
.thatsStrokeColored(red)
.thatsTranslated(-90, -35),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsRotated(45)
.thatsStrokeColored(red)
.thatsTranslated(-290, -150)
)
def roseArr2 = picStack(
leaf2
.thatsRotated(-40)
.thatsScaled(0.8,0.8)
.thatsTranslated(-15, 10),
leaf2
.thatsRotated(60)
.thatsScaled(0.8,0.8)
.thatsTranslated(22, 25),
leaf2
.thatsRotated(-235)
.thatsScaled(0.8,0.8)
.thatsTranslated(-100, -20),
leaf2
.thatsRotated(100)
.thatsScaled(0.8,0.8)
.thatsTranslated(-10, 50),
rose1
.thatsFilledWith(colorR1)
.thatsStrokeColored(red)
.thatsScaled(0.8,0.8)
.thatsTranslated(-80, 120),
rose1
.thatsFilledWith(colorR2)
.thatsStrokeColored(red)
.thatsScaled(0.9,0.9)
.thatsTranslated(145, 12),
rose1
.thatsFilledWith(colorR4)
.thatsStrokeColored(red)
.thatsScaled(0.7,0.7)
.thatsTranslated(45, 120),
rose1
.thatsFilledWith(colorR5)
.thatsStrokeColored(red)
.thatsScaled(0.9,0.9)
.thatsTranslated(-170, -8),
ovalOne
.thatsScaled(0.04,1.8)
.thatsStrokeSized(15)
.thatsStrokeColored(black)
.thatsFilledWith(blue)
.thatsTranslated(-10, 130),
flame2
.thatsFilledWith(red)
.thatsScaled(0.4,0.4)
.thatsTranslated(-10, 300),
rose1
.thatsFilledWith(colorR1)
.thatsTranslated(43, 10)
.thatsStrokeColored(red)
.thatsTranslated(-55, -45),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(-120, 35),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(-130, 10),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(-100, 10),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(30, 60),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(20, 32),
flower
.thatsFilledWith(white)
.thatsScaled(0.14,0.14)
.thatsStrokeColored(red)
.thatsTranslated(50, 32)
)
def roseArr3 = picStack(
leaf2
.thatsRotated(-40)
.thatsScaled(0.2,0.2)
.thatsTranslated(1, 110),
leaf2
.thatsRotated(90)
.thatsScaled(0.2,0.2)
.thatsTranslated(1, 98),
leaf2
.thatsRotated(210)
.thatsScaled(0.2,0.2)
.thatsTranslated(10, 108),
rose1
.thatsFilledWith(colorR1)
.thatsScaled(0.2,0.2)
.thatsTranslated(-10, 118),
rose1
.thatsFilledWith(colorR2)
.thatsScaled(0.2,0.2)
.thatsTranslated(20, 118),
rose1
.thatsFilledWith(colorR4)
.thatsScaled(0.2,0.2)
.thatsTranslated(6, 100),
flower
.thatsFilledWith(white)
.thatsScaled(0.03,0.03)
.thatsStrokeColored(red)
.thatsTranslated(0,115)
)
def leftCh = picStack(
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-108, 160),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-110, 146),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-96, 140),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-82, 135),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-68, 132),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-53, 130),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-38, 128),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-23, 126),
round
.thatsScaled(0.15,0.15)
.thatsFilledWith(colorR4)
.thatsTranslated(-8, 126)
)
def cherry = picStack(
leftCh,
leftCh
.withFlippedX
)
def flame2 = Picture.fromPath {
x =>
x.moveTo(0,0)
x.arc(0, 150, 80)
x.arc(0, 0, 80)
x.closePath()
}
def cakeStack = picStack(
ovalOne
.thatsScaled(0.55,0.55)
.thatsFilledWith(Color(102, 0, 102))
.thatsStrokeColored(Color(102, 0, 102))
.thatsTranslated(0,5),
cake1
.thatsScaled(0.5,0.5)
.thatsStrokeColored(Color(255, 102, 0))
.thatsFilledWith(color3)
.thatsTranslated(0, 90),
cherry
.thatsScaled(1.1,1.1)
.thatsTranslated(-1, -76),
cake1
.thatsScaled(0.4,0.4)
.thatsStrokeColored(Color(255, 102, 0))
.thatsFilledWith(color3)
.thatsTranslated(0, 170),
cherry
.thatsScaled(0.85,0.9)
.thatsTranslated(-1, 40),
cake1
.thatsScaled(0.3,0.3)
.thatsStrokeColored(Color(255, 102, 0))
.thatsFilledWith(color3)
.thatsTranslated(0, 235),
roseArr
.thatsScaled(0.3,0.3)
.thatsTranslated(134, 40),
roseArr
.thatsScaled(0.3,0.3)
.withFlippedX
.thatsTranslated(-134, 40),
roseArr2
.thatsScaled(0.3,0.2)
.thatsTranslated(10, 238),
roseArr3
.thatsTranslated(0, -4),
roseArr3
.thatsTranslated(-85, 4),
roseArr3
.thatsTranslated(83, 4),
roseArr3
.thatsScaled(0.5,0.5)
.thatsTranslated(-70, 144),
roseArr3
.thatsScaled(0.5,0.5)
.thatsTranslated(-35, 135),
roseArr3
.thatsScaled(0.5,0.5)
.thatsTranslated(3, 133),
roseArr3
.thatsScaled(0.5,0.5)
.thatsTranslated(38, 135),
roseArr3
.thatsScaled(0.5,0.5)
.thatsTranslated(70, 145),
roseArr3
.thatsScaled(0.7,0.7)
.thatsTranslated(0, -90)
)
def ba1 = picStack(
ba
.thatsRotated(-2)
.thatsFilledWith(red)
.thatsTranslated(-13,-13),
ba
.thatsRotated(5)
.thatsFilledWith(green)
.thatsStrokeColored(green)
.thatsTranslated(62,22),
ba
.thatsRotated(14)
.thatsFilledWith(blue)
.thatsStrokeColored(blue)
.thatsTranslated(140,80),
ba
.thatsRotated(23)
.thatsFilledWith(Color(255, 164, 49))
.thatsStrokeColored(Color(255, 164, 49))
.thatsTranslated(208, 143),
ba
.thatsRotated(33)
.thatsFilledWith(Color(176, 116, 22))
.thatsStrokeColored(Color(176,116,22))
.thatsTranslated(266, 223)
)
def ba2 = picStack(
ba
.thatsRotated(-31)
.thatsFilledWith(Color(116, 173, 88))
.thatsStrokeColored(Color(116,173,88))
.thatsTranslated(169, -54),
ba
.thatsRotated(-24)
.thatsFilledWith(Color(255, 0, 255))
.thatsStrokeColored(Color(255,0,255))
.thatsTranslated(251, -61),
ba
.thatsRotated(-14)
.thatsFilledWith(Color(11, 158, 158))
.thatsStrokeColored(Color(11,158,158))
.thatsTranslated(350, -46),
ba
.thatsRotated(-4)
.thatsFilledWith(Color(255, 102, 102))
.thatsStrokeColored(Color(255,102,102))
.thatsTranslated(445, -15),
ba
.thatsRotated(2)
.thatsFilledWith(Color(0, 204, 204))
.thatsStrokeColored(Color(0,204,204))
.thatsTranslated(518, 10),
ba
.thatsRotated(7)
.thatsFilledWith(Color(67, 99, 163))
.thatsStrokeColored(Color(67,99,163))
.thatsTranslated(584, 36),
ba
.thatsRotated(14)
.thatsFilledWith(Color(0, 153, 255))
.thatsStrokeColored(Color(0,153,255))
.thatsTranslated(654, 83),
ba
.thatsRotated(22)
.thatsFilledWith(Color(204, 0, 153))
.thatsStrokeColored(Color(204,0,153))
.thatsTranslated(719, 143)
)
def banner = picStack(
ba1
.thatsRotated(-3)
.thatsTranslated(-15,-10),
ba2
.thatsRotated(2)
.thatsTranslated(-38,-10),
arcOne
.thatsStrokeColored(Color(185, 119, 14))
.thatsStrokeSized(3)
.thatsScaled(1.9,1.8)
.thatsRotated(-130)
.thatsTranslated(-235, 620),
arcOne
.thatsStrokeColored(Color(185, 119, 14))
.thatsStrokeSized(3)
.thatsScaled(1.9,1.8)
.thatsRotated(-130)
.thatsTranslated(208, 620),
string
.thatsRotated(8)
.thatsStrokeColored(Color(89, 89, 81))
.thatsTranslated(-420, 210),
balloon
.thatsRotated(-25)
.thatsStrokeColored(color6)
.thatsFilledWith(color6)
.thatsTranslated(-420, 216),
string
.thatsRotated(-20)
.thatsStrokeColored(Color(89, 89, 81))
.thatsTranslated(-333, 195),
balloon
.thatsRotated(-25)
.thatsStrokeColored(color7)
.thatsFilledWith(color7)
.thatsTranslated(-335, 200),
string
.thatsStrokeColored(Color(89, 89, 81))
.thatsTranslated(-394, 115),
balloon
.thatsRotated(-25)
.thatsStrokeColored(color8)
.thatsFilledWith(color8)
.thatsTranslated(-395, 115),
string
.thatsStrokeColored(Color(89, 89, 81))
.thatsTranslated(414, 220),
balloon
.thatsRotated(-25)
.thatsStrokeColored(color9)
.thatsFilledWith(color9)
.thatsTranslated(412, 220),
string
.thatsStrokeColored(Color(89, 89, 81))
.thatsTranslated(430, 120),
balloon
.thatsRotated(-25)
.thatsStrokeColored(color8)
.thatsFilledWith(color8)
.thatsTranslated(428, 115)
)
def Oval = Picture.fromPath {
x =>
x.moveTo(0, 0)
x.arc(0, 100, 130)
x.arc(-50, 78, 95)
x.arc(0, 0, 116)
x.closePath()
}
def eqTri = Picture{
right()
forward(10)
left(120)
forward(10)
left(120)
forward(10)
}
def balloon = picStack(
Oval,
eqTri
.thatsRotated(15)
.thatsTranslated(-1, -10)
)
def string = Picture.fromPath {
x =>
x.moveTo(0, 0)
x.arc(0, -50, 40)
x.arc(0, -100, -40)
x.arc(0,-150, 40)
x.arc(0, -200, -40)
}
def ba = Picture{
left()
hop(280)
right
hop(250)
right
forward(44)
right(90)
forward(52)
right(120)
forward(25)
left(60)
forward(25)
right(120)
forward(50)
}
def H = Picture{
setPenColor(white)
setPenFontSize(45)
write("H")
}
def A = Picture{
setPenColor(white)
setPenFontSize(45)
write("A")
}
def P = Picture{
setPenColor(white)
setPenFontSize(45)
write("P")
}
def Y= Picture{
setPenColor(white)
setPenFontSize(45)
write("Y")
}
def B = Picture{
setPenColor(white)
setPenFontSize(45)
write("B")
}
def I = Picture{
setPenColor(white)
setPenFontSize(40)
write("I")
}
def R = Picture{
setPenColor(white)
setPenFontSize(45)
write("R")
}
def T = Picture{
setPenColor(white)
setPenFontSize(45)
write("T")
}
def D = Picture{
setPenColor(white)
setPenFontSize(45)
write("D")
}
def happyBirthday = picStack(
H
.thatsRotated(-2)
.thatsTranslated(-288, 256),
A
.thatsRotated(2)
.thatsTranslated(-239, 257),
P
.thatsRotated(9)
.thatsTranslated(-192, 262),
P
.thatsRotated(16)
.thatsTranslated(-148, 273),
Y
.thatsRotated(21)
.thatsTranslated(-105, 291),
B
.thatsRotated(-28)
.thatsTranslated(12, 299),
I
.thatsRotated(-22)
.thatsTranslated(60, 274),
R
.thatsRotated(-14)
.thatsTranslated(95, 265),
T
.thatsRotated(-4)
.thatsTranslated(140, 258),
H
.thatsRotated(2)
.thatsTranslated(182, 256),
D
.thatsRotated(9)
.thatsTranslated(227, 258),
A
.thatsRotated(17)
.thatsTranslated(272, 266),
Y
.thatsRotated(17)
.thatsTranslated(320, 285)
)
happyBirthday.draw
def shape1 = Picture.fromPath {
x =>
x.moveTo(100, 45)
x.lineTo(140, 100)
x.lineTo(140, 55)
x.lineTo(100, 0)
x.lineTo(100, 45)
x.closePath()
}
def shape2 = Picture.fromPath {
x =>
x.moveTo(103, 55)
x.lineTo(103, 45)
x.lineTo(-3, 45)
x.lineTo(-3, 55)
x.lineTo(103, 55)
x.lineTo(142, 110)
x.lineTo(142, 100)
x.lineTo(103, 45)
x.closePath()
}
def shape3 = Picture.fromPath {
x =>
x.moveTo(-3, 55)
x.lineTo(45, 110)
x.lineTo(142, 110)
x.lineTo(103, 55)
x.lineTo(-3, 55)
x.closePath()
}
def shape4 = Picture.fromPath {
x =>
x.moveTo(43, 40)
x.lineTo(90, 77)
x.lineTo(104, 77)
x.lineTo(58, 40)
x.closePath()
}
def shape5 = Picture.fromPath {
x =>
x.moveTo(120, 52)
x.lineTo(16, 55)
x.lineTo(27, 63)
x.lineTo(126, 61)
x.closePath()
}
def shape6 = Picture.fromPath {
x =>
x.moveTo(118, 16)
x.lineTo(118, 47)
x.lineTo(128, 57)
x.lineTo(128, 26)
x.closePath()
}
def bow1 = picStack(
arcSeven
.thatsFilledWith(green),
arcSeven
.thatsFilledWith(green)
.withFlippedX,
square1
.thatsFilledWith(red)
.thatsTranslated(-8, -10)
)
def gift1 = picStack(
box
.thatsStrokeColored(Color(0, 0, 255))
.thatsFilledWith(Color(51, 51, 255)),
shape1
.thatsStrokeColored(Color(0, 0, 255))
.thatsFilledWith(color9),
shape2
.thatsStrokeColored(Color(0, 0, 255))
.thatsFilledWith(color9),
shape3
.thatsStrokeColored(Color(0, 0, 255))
.thatsFilledWith(color9),
square1
.thatsScaled(1,1.8)
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow)
.thatsTranslated(43, 0),
square1
.thatsScaled(1,0.4)
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow)
.thatsTranslated(43, 47)
)
def gift2 = picStack(
box
.thatsStrokeColored(Color(204, 0, 0))
.thatsFilledWith(colorR4),
shape1
.thatsStrokeColored(Color(204, 0, 0))
.thatsFilledWith(colorR4),
shape2
.thatsStrokeColored(Color(204, 0, 0))
.thatsFilledWith(colorR4),
shape3
.thatsStrokeColored(Color(204, 0, 0))
.thatsFilledWith(colorR4),
square1
.thatsScaled(1,1.8)
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204))
.thatsTranslated(43, 0),
square1
.thatsScaled(1,0.4)
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204))
.thatsTranslated(43, 47)
)
def wrap = picStack(
shape4
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow),
shape5
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow),
shape6
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow)
.thatsTranslated(1, 2),
shape6
.thatsScaled(1.2,0.1)
.thatsStrokeColored(Color(255, 244, 65))
.thatsFilledWith(yellow)
.thatsRotated(38)
.thatsTranslated(09, -39),
bow1
.thatsScaled(0.15,0.2)
.thatsTranslated(70, 60),
bow1
.thatsScaled(0.15,0.2)
.thatsRotated(90)
.thatsTranslated(70, 60)
)
def wrap2 = picStack(
shape4
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204)),
shape5
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204)),
shape6
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204))
.thatsTranslated(1, 2),
shape6
.thatsScaled(1.2,0.1)
.thatsStrokeColored(Color(255, 218, 146))
.thatsFilledWith(Color(255, 204, 204))
.thatsRotated(38)
.thatsTranslated(09, -39),
bow1
.thatsScaled(0.15,0.2)
.thatsFilledWith(Color(153, 255, 0))
.thatsStrokeColored(Color(17, 102, 17))
.thatsRotated(-10)
.thatsTranslated(70, 60),
bow1
.thatsScaled(0.15,0.2)
.thatsFilledWith(Color(153, 255, 0))
.thatsStrokeColored(Color(17, 102, 17))
.thatsRotated(50)
.thatsTranslated(70, 60)
)
def gift3 = picStack(
arcEight
.thatsStrokeColored(Color(0, 204, 0))
.thatsFilledWith(Color(102, 255, 102)),
arcNine
.thatsStrokeColored(Color(0, 204, 0))
.thatsFilledWith(Color(0, 204, 0)),
ovalTwo
.thatsStrokeColored(Color(0, 204, 0))
.thatsFilledWith(Color(153, 255, 153)),
square1
.thatsScaled(1,2.4)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -123),
square1
.thatsScaled(1,0.9)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -60),
square1
.thatsScaled(11.6,0.6)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-87, -8),
square1
.thatsScaled(1,2.9)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -34),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(145)
.thatsTranslated(-88,0),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(145)
.withFlippedX
.thatsTranslated(88,0),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(50)
.thatsTranslated(0,30),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(230)
.thatsTranslated(1,-27),
bow1
.thatsScaled(0.30,0.30)
.thatsFilledWith(Color(255, 51, 51))
.thatsStrokeColored(brown)
.thatsTranslated(0, 0),
bow1
.thatsScaled(0.30,0.30)
.thatsRotated(90)
.thatsFilledWith(Color(255, 51, 51))
.thatsStrokeColored(brown)
.thatsTranslated(0, 0)
)
def gift4 = picStack(
arcEight
.thatsStrokeColored(Color(255, 51, 51))
.thatsFilledWith(Color(255, 102, 51)),
arcNine
.thatsStrokeColored(Color(255, 51, 51))
.thatsFilledWith(Color(255, 51, 51)),
ovalTwo
.thatsStrokeColored(Color(255, 51, 51))
.thatsFilledWith(Color(255, 153, 51)),
square1
.thatsScaled(1,2.4)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -123),
square1
.thatsScaled(1,0.9)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -60),
square1
.thatsScaled(11.6,0.6)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-87, -8),
square1
.thatsScaled(1,2.9)
.thatsStrokeColored(Color(153, 51, 255))
.thatsFilledWith(Color(153, 51, 255))
.thatsTranslated(-7, -34),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(145)
.thatsTranslated(-88,0),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(145)
.withFlippedX
.thatsTranslated(88,0),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(50)
.thatsTranslated(0,30),
arcTen
.thatsScaled(0.8,0.8)
.thatsFilledWith(Color(153, 51, 255))
.thatsStrokeColored(Color(153, 51, 255))
.thatsRotated(230)
.thatsTranslated(1,-27),
bow1
.thatsScaled(0.30,0.30)
.thatsFilledWith(yellow)
.thatsStrokeColored(Color(177, 177, 15))
.thatsTranslated(0, 0),
bow1
.thatsScaled(0.30,0.30)
.thatsRotated(90)
.thatsFilledWith(yellow)
.thatsStrokeColored(Color(177, 177, 15))
.thatsTranslated(0, 0)
)
gift1
.thatsScaled(1,0.7)
.thatsTranslated(-310, -58)
.draw
wrap
.thatsTranslated(-310, -58)
.draw
gift2
.thatsScaled(1,0.7)
.thatsTranslated(-325, -10)
.draw
wrap2
.thatsTranslated(-325, -10)
.draw
cap2.draw
cap1.draw
gift4
.thatsScaled(0.6,0.6)
.thatsTranslated(165, -15)
.draw
def kn1 = Picture.fromPath {
x =>
x.moveTo(40, 170)
x.arc(-30, 190, 190)
x.lineTo(-40, 70)
x.lineTo(20, 70)
x.arc(25, 100, -90)
x.arc(25, 130, -90)
x.arc(39, 171, -90)
x.closePath()
}
def kn2 = Picture.fromPath {
x =>
x.moveTo(-40, 70)
x.lineTo(-55, 58)
x.lineTo(-40, 50)
x.lineTo(20, 50)
x.lineTo(35, 60)
x.lineTo(20, 70)
x.closePath()
}
def kn3 = Picture.fromPath {
x =>
x.moveTo(-40, 50)
x.lineTo(-60, -180)
x.arc(10, 25, 25)
x.lineTo(-5, 25)
x.arc(-58, -160, -25)
x.arc(-5, 25, 25)
x.lineTo(10, 25)
x.lineTo(16, 50)
}
def knife = picStack(
kn1
.thatsFilledWith(brown)
.thatsStrokeColored(brown),
kn2
.thatsFilledWith(brown)
.thatsStrokeColored(brown),
kn3
.thatsFilledWith(Color(204, 204, 204))
.thatsStrokeColored(Color(86, 72, 72)),
bow1
.thatsScaled(0.80,0.80)
.thatsFilledWith(Color(0, 255, 255))
.thatsStrokeColored(Color(0, 158, 226))
.thatsTranslated(-10, 70)
)
knife
.thatsRotatedAround(80, -67, 380)
.withFlippedY
.thatsScaled(0.2,0.2)
.draw
def face = Picture.fromPath {
x =>
x.moveTo(0, 90)
x.arc(0, 240, -180)
x.arc(0, 90, -180)
x.closePath()
}
def ear = Picture.fromPath {
x =>
x.moveTo(55, 210)
x.arc(95, 180, -140)
x.arc(70, 145, -145)
x.closePath()
}
def mouth = Picture.fromPath {
x =>
x.moveTo(0,100)
x.arc(0, 170, -190)
x.arc(0, 100, -199)
x.closePath()
}
def hand = Picture.fromVertexShape {
x =>
x.beginShape()
x.vertex(54, 110)
x.bezierVertex(
95, 90,
150, 28,
120, 0
)
x.bezierVertex(
92, 10,
92, 10,
75, 0
)
x.bezierVertex(
65, 30,
65, 30,
75, 40
)
x.vertex(70, 35)
x.bezierVertex(
48, 50,
48, 50,
26, 90
)
x.endShape()
}
def head = picStack(
ear
.thatsScaled(1,1.4)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7)
.thatsTranslated(0, -70),
ear
.thatsScaled(1,1.4)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7)
.withFlippedX
.thatsTranslated(0, -70),
face
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7),
round
.thatsScaled(0.2,0.2)
.thatsFilledWith(black)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(9)
.thatsTranslated(-20, 170),
round
.thatsScaled(0.029999,0.029999)
.thatsFilledWith(white)
.thatsStrokeColored(white)
.thatsTranslated(-24, 174),
round
.thatsScaled(0.2,0.2)
.thatsFilledWith(black)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(9)
.thatsTranslated(20, 170),
round
.thatsScaled(0.029999,0.029999)
.thatsFilledWith(white)
.thatsStrokeColored(white)
.thatsTranslated(18, 176),
ch1
.thatsRotated(130)
.thatsScaled(1.2,1.4)
.thatsStrokeColored(Color(178, 119, 0))
.thatsTranslated(17, 210),
mouth
.thatsFilledWith(pink)
.thatsStrokeColored(Color(216, 141, 23))
.thatsStrokeSized(4),
ovalTwo
.thatsScaled(0.15,0.18)
.thatsFilledWith(Color(193, 129, 29))
.thatsTranslated(0, 150),
ch1
.thatsRotated(160)
.thatsTranslated(20, 135),
ch1
.thatsRotated(230)
.thatsScaled(1,1.5)
.thatsTranslated(18, 145),
ch1
.thatsRotated(230)
.thatsScaled(1,1.5)
.withFlippedX
.thatsTranslated(-10, 145)
)
def body = picStack(
round
.thatsScaled(0.8,0.4)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(9)
.thatsTranslated(-69, -60),
round
.thatsScaled(0.8,0.4)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(9)
.thatsTranslated(69, -60),
round
.thatsScaled(1.6,1.7)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7)
.thatsTranslated(0,8),
hand
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7),
hand
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7)
.withFlippedX,
round
.thatsScaled(0.8,1)
.thatsRotated(-25)
.thatsTranslated(100, -40)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7),
round
.thatsScaled(0.5,0.6)
.thatsRotated(-25)
.thatsTranslated(100, -40)
.thatsFilledWith(pink)
.thatsStrokeColored(Color(178, 119, 0)),
round
.thatsScaled(0.8,1)
.thatsRotated(-25)
.thatsTranslated(100, -40)
.thatsFilledWith(color10)
.thatsStrokeColored(Color(178, 119, 0))
.thatsStrokeSized(7)
.withFlippedX,
round
.thatsScaled(0.5,0.6)
.thatsRotated(-25)
.thatsTranslated(100, -40)
.thatsFilledWith(pink)
.thatsStrokeColored(Color(178, 119, 0))
.withFlippedX
)
def teddy = picStack(
head,
body
)
teddy
.thatsScaled(0.7,0.7)
.thatsTranslated(330, 0)
.draw
bow1
.thatsScaled(0.35,0.35)
.thatsFilledWith(Color(0, 0, 255))
.thatsStrokeColored(Color(0, 50, 36))
.thatsTranslated(330, 60)
.draw
teddy
.thatsScaled(0.3,0.3)
.thatsTranslated(330, -50)
.draw
bow1
.thatsScaled(0.15,0.15)
.thatsFilledWith(Color(153, 0, 0))
.thatsStrokeColored(Color(204, 0, 102))
.thatsTranslated(330, -26)
.draw
def shape7 = Picture.fromPath {
x =>
x.moveTo(0, 200)
x.lineTo(-20, 50)
x.lineTo(70, 40)
x.lineTo(85, 210)
x.lineTo(0, 200)
x.closePath()
}
def shape8 = Picture.fromPath {
x =>
x.moveTo(100,200)
x.lineTo(115, 200)
x.lineTo(100, 50)
x.lineTo(85, 60)
x.lineTo(100, 200)
x.lineTo(85, 209)
x.lineTo(70, 40)
x.lineTo(85, 60)
x.closePath()
}
def shape9 = Picture.fromPath {
x =>
x.moveTo(55, 190)
x.lineTo(52, 150)
x.arc(20, 150, -190)
x.lineTo(20,185)
}
def bag = picStack(
eqTri
.thatsScaled(2.90,2)
.thatsRotated(17)
.thatsStrokeSized(1)
.thatsTranslated(71, 41),
shape7,
shape8,
shape9
.thatsStrokeColored(Color(153, 153, 153))
.thatsStrokeSized(4),
round
.thatsScaled(0.04,0.04)
.thatsStrokeSized(95)
.thatsTranslated(20, 185),
round
.thatsScaled(0.04,0.04)
.thatsStrokeSized(95)
.thatsTranslated(55, 189)
)
bag
.withFlippedX
.thatsFilledWith(red)
.thatsStrokeColored(Color(204, 0, 0))
.thatsScaled(0.6,0.6)
.thatsTranslated(-360,-70)
.draw
bag
.withFlippedX
.thatsFilledWith(Color(31, 158, 31))
.thatsStrokeColored(Color(0, 102, 0))
.thatsScaled(0.5,0.5)
.thatsTranslated(-335,-70)
.draw
def tri = Picture.fromPath {
x =>
x.moveTo(0, 0)
x.lineTo(45, 100)
x.lineTo(80, 0)
x.arc(0, 0, -50)
x.closePath()
}
def cap1 = picStack(
tri
.thatsFilledWith(yellow)
.thatsStrokeColored(yellow)
.thatsTranslated(78, 10),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(blue)
.thatsTranslated(145, 18),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(green)
.thatsTranslated(90, 18),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(red)
.thatsTranslated(117, 15),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(brown)
.thatsTranslated(107, 40),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(green)
.thatsTranslated(135, 42),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(red)
.thatsTranslated(109, 64),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(blue)
.thatsTranslated(130, 72),
round
.thatsScaled(0.12,0.12)
.thatsFilledWith(red)
.thatsTranslated(122, 98)
)
cakeStack
.thatsScaled(0.8,0.8)
.thatsTranslated(-34,-40)
.draw
gift3
.thatsScaled(0.4,0.4)
.thatsTranslated(-200, -48)
.draw
def shape10 = Picture.fromPath {
x =>
x.moveTo(153, 10)
x.arc(223, 20, 80)
}
def cap2 = picStack(
tri
.thatsFilledWith(red)
.thatsTranslated(150, 0),
shape10
.thatsStrokeColored(green)
.thatsStrokeSized(6),
shape10
.thatsScaled(0.67,0.6)
.thatsRotated(5)
.thatsStrokeColored(Color(217, 255, 0))
.thatsStrokeSized(8)
.thatsTranslated(65, 19),
shape10
.thatsScaled(0.4,0.4)
.thatsRotated(6)
.thatsStrokeColored(Color(51, 255, 255))
.thatsStrokeSized(8)
.thatsTranslated(118, 50),
shape10
.thatsScaled(0.24,0.2)
.thatsRotated(12)
.thatsStrokeColored(Color(255, 255, 204))
.thatsStrokeSized(14)
.thatsTranslated(149, 70)
)