Code Sketch
nagesh
cleari
//showAxes()
//showGrid()
def baseColor = cm.linearGradient(
0, 0,
Color(189, 141, 147),
200, 0,
Color(94, 60, 6),
true)
setFillColor(baseColor)
//set background color
def bkColor = cm.linearGradient(
0, -80,
ColorMaker.hsl(197, 0.71, 0.74),
0, -100,
brown,
false);
def BackgroundColor = cm.radialMultipleGradient(
360, 220,
224,
Seq(0.9,0.95),
Seq(noColor, black),
false)
// set the backgoundcolor
setBackground(bkColor);
def sunColor = cm.radialMultipleGradient(
40, 40,
40,
Seq(0.7,0.9),
Seq(yellow, cm.skyBlue),
false
);
//setBackground(sunColor);
def square(side : Int) = {
setPenColor(noColor)
repeat(4){ forward(side); right }
}
setFillColor(sunColor)
def sun = Picture(square(120));
sun
.withTranslation(-100, 100)
.withFillColor(sunColor)
.draw();
//define frame
def frame = Picture(square(800));
frame
.withTranslation(-350, -210)
.withFillColor(BackgroundColor)
.draw();
//create a wing arc
def wing = Picture {
left(25)
left(80,20)
}
//create a picture stack of wing as crow
def crow = picStack(
wing.withFlippedX,
wing
).thatsStrokeColored(black);
//draw the flock of crows
def crowFlock = picStack(
crow,
crow
.withTranslation(60, 4),
crow
.withTranslation(60, 4)
.withTranslation(60, 4),
crow
.withTranslation(60, 4)
.withTranslation(60, 4),
crow
.withTranslation(60, 4)
.withTranslation(60, 4)
.withTranslation(60, 4),
crow
.withTranslation(60, 4)
.withTranslation(60, 4)
.withTranslation(60, 4)
.withTranslation(60, 4),
)
crowFlock.withTranslation(0, 150).draw();
//tangram.draw
//draw trees
tree.thatsTranslated(-300, 150).thatsScaled(0.3).draw
tree.thatsTranslated(300, 150).thatsScaled(0.3).draw
//Draw house
house.thatsTranslated(50, -50).thatsScaled(0.3).draw
//draw dog
dog.thatsTranslated(250, -450).thatsScaled(0.2).draw()
//Draw flowerpot
flowerpot.thatsTranslated(-350, -350).thatsScaled(0.2).draw();
//write best wishes
setPosition(-60, -130)
setPenFontSize(36)
setPenFont(Font("Jokerman", 25))
setPenColor(Color(255, 255, 255))
write("Best Wishes")
def tangram = picStack(
Picture {},
//square.thatsFilledWith(red),
// triangle1.thatsFilledWith(green).thatsTranslated(0, -100),
// triangle2.thatsFilledWith(blue),
//triangle2.thatsFilledWith(pink).thatsRotated(90),
//triangle3.thatsFilledWith(cm.gray),
//parallelogram.thatsFilledWith(brown).thatsTranslated(-100, 0),
//triangle4.thatsFilledWith(orange).thatsTranslated(0, -100),
)
def tree = picStack(
Picture {},
square.thatsFilledWith(brown).thatsRotated(45).thatsTranslated(15, -85),
triangle2.thatsFilledWith(green).thatsRotated(270).thatsTranslated(12, 15),
triangle1.thatsFilledWith(green).thatsRotated(0).thatsTranslated(62, -34),
triangle3.thatsFilledWith(green).thatsRotated(270).thatsTranslated(62, -34),
triangle2.thatsFilledWith(green).thatsRotated(270).thatsTranslated(50, 115),
triangle4.thatsFilledWith(green).thatsRotated(225).thatsTranslated(-20, 115),
parallelogram.thatsRotated(270).withFlippedY.thatsFilledWith(green).thatsTranslated(114,-85),
)
def house = picStack(
Picture {},
triangle2.thatsFilledWith(blue).thatsRotated(45),
triangle2.thatsFilledWith(pink).thatsRotated(135),
triangle4.thatsFilledWith(orange).thatsRotated(45).thatsTranslated(30, 0),
triangle1.thatsFilledWith(green).thatsRotated(225).thatsTranslated(30, 0),
triangle3.thatsFilledWith(cm.gray).thatsRotated(225).thatsTranslated(-110, -70),
square.thatsFilledWith(red).thatsRotated(45).thatsTranslated(30, 0),
parallelogram.thatsFilledWith(brown).thatsTranslated(50, 90),
)
def dog = picStack(
Picture {},
triangle2.thatsFilledWith(blue).thatsRotated(45),
triangle2.thatsFilledWith(pink).thatsRotated(225).thatsTranslated(210, 70),
triangle1.thatsFilledWith(green).thatsRotated(135).thatsTranslated(210, -70),
square.thatsFilledWith(red).thatsRotated(45).thatsTranslated(0, 0),
parallelogram.thatsFilledWith(brown).thatsRotated(135).withFlippedX.thatsTranslated(-70, 140),
triangle4.thatsFilledWith(orange).thatsRotated(225).thatsTranslated(-140, 70),
triangle3.thatsFilledWith(cm.gray).thatsRotated(126).thatsTranslated(215, 140),
//
//
)
def flowerpot = picStack(
Picture {},
triangle2.thatsFilledWith(blue).thatsRotated(225),
triangle2.thatsFilledWith(pink).thatsRotated(-45),
square.thatsFilledWith(red).thatsTranslated(0, 170),
triangle1.thatsFilledWith(green).thatsRotated(135).thatsTranslated(0, 70),
triangle3.thatsFilledWith(cm.gray).thatsRotated(225).withFlippedX.thatsTranslated(70, 70),
//parallelogram.thatsFilledWith(brown).thatsTranslated(-100, 0),
triangle4.thatsFilledWith(orange).thatsRotated(45).thatsTranslated(72, 70),
)
def square = Picture{
right(135)
forward(70.71)
right(90)
forward(70.71)
right(90)
forward(70.71)
right(90)
forward(70.71)
right(90)
}.thatsStrokeColored(black)
def triangle1 = Picture{
right()
forward(100)
left(135)
forward(70.71)
left(90)
forward(70.71)
}.thatsStrokeColored(black)
def triangle2 = Picture{
right(135)
forward(141.42)
left(135)
forward(200)
left(135)
forward(141.42)
}.thatsStrokeColored(black)
def triangle3 = Picture{
left(45)
forward(70.71)
left(135)
forward(100)
left(135)
forward(70.71)
}.thatsStrokeColored(black)
def parallelogram = Picture{
forward(100)
right(135)
forward(70.71)
right(45)
forward(100)
right(135)
forward(70.71)
}.thatsStrokeColored(black)
def triangle4 = Picture {
left(45)
forward(141.42)
left(135)
forward(100)
left(90)
forward(100)
}.thatsStrokeColored(black)