Code Sketch
trangram assignment2
cleari
//size(1990, 1990)
setBackgroundH(blue, green)
//showAxes()
//showGrid()
def shape3 = 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 shape4 = Picture{
right()
forward(100)
left(135)
forward(70.71)
left(90)
forward(70.71)
}.thatsStrokeColored(black)
def shape1 = Picture{
right(135)
forward(141.42)
left(135)
forward(200)
left(135)
forward(141.42)
}.thatsStrokeColored(black)
def shape5 = Picture{
left(45)
forward(70.71)
left(135)
forward(100)
left(135)
forward(70.71)
}.thatsStrokeColored(black)
def shape6 = Picture{
forward(100)
right(135)
forward(70.71)
right(45)
forward(100)
right(135)
forward(70.71)
}.thatsStrokeColored(black)
def shape7 = Picture {
left(45)
forward(141.42)
left(135)
forward(100)
left(90)
forward(100)
}.thatsStrokeColored(black)
def fish = picStack(
Picture{},
shape1.thatsRotated(135).thatsFilledWith(red),
shape1.thatsRotated(135).thatsFilledWith(yellow).withFlippedY,
shape3.thatsFilledWith(blue).thatsRotated(45).thatsTranslated(0, 40),
shape4.thatsFilledWith(purple).thatsRotated(135).thatsTranslated(70, 40),
shape4.thatsFilledWith(cm.orange).thatsRotated(45).thatsTranslated(0, -100),
shape6.thatsRotated(-45).withFlippedX.thatsFilledWith(green).thatsTranslated(140, -30),
shape7.thatsRotated(-45).thatsTranslated(140, -30).thatsFilledWith(ColorMaker.hsl(199, 1.00, 0.50))
)
def bird = picStack(
Picture {},
shape1.thatsRotated(90).thatsFilledWith(yellow),
shape1.thatsRotated(135).thatsTranslated(100, -41).thatsFilledWith(red),
shape7.thatsRotated(135).thatsTranslated(100, 100).thatsFilledWith(ColorMaker.hsl(180, 1.00, 0.50)),
shape3.thatsTranslated(120, 180).thatsFilledWith(cm.green),
shape4.thatsRotated(90).thatsTranslated(170, 30).thatsFilledWith(cm.orange),
shape6.withFlippedX.thatsTranslated(120, 180).thatsFilledWith(green),
shape4.thatsRotated(135).thatsFilledWith(purple).thatsTranslated(190, 210)
)
def tree =picStack(
Picture {},
shape3.thatsRotated(45).thatsFilledWith(cm.green),
shape1.thatsRotated(-90).thatsTranslated(-20, 100).thatsFilledWith(red),
shape6.thatsRotated(-90).withFlippedX.thatsTranslated(130, 50).thatsFilledWith(green),
shape4.thatsTranslated(30, 50).thatsFilledWith(purple),
shape4.thatsRotated(180).thatsTranslated(80, 100).thatsFilledWith(cm.orange),
shape1.thatsRotated(-90).thatsTranslated(30, 200).thatsFilledWith(yellow),
shape7.thatsRotated(-135).thatsTranslated(-40, 200).thatsFilledWith(ColorMaker.hsl(186, 1.00, 0.50))
)
def dog = picStack(
Picture{},
shape1.thatsRotated(45).thatsFilledWith(yellow),
shape3.thatsRotated(45).thatsFilledWith(cm.green),
shape4.thatsRotated(135).thatsTranslated(210, -70).thatsFilledWith(purple),
shape1.thatsRotated(-135).thatsFilledWith(red).thatsTranslated(211, 72),
shape4.thatsRotated(45).thatsTranslated(210, 70).thatsFilledWith(ColorMaker.hsl(25, 1.00, 0.50)),
shape6.thatsRotated(-45).withFlippedX.thatsTranslated(0, 140).thatsFilledWith(green),
shape7.thatsRotated(-135).thatsTranslated(-140, 69).thatsFilledWith(ColorMaker.hsl(188, 1.00, 0.50))
)
def boat = picStack(
Picture{},
shape1.thatsRotated(-90).thatsFilledWith(yellow),
shape1.thatsFilledWith(red),
shape3.thatsRotated(45).thatsTranslated(120, -30).thatsFilledWith(cm.green),
shape4.thatsRotated(135).thatsTranslated(260, -100).thatsFilledWith(cm.orange),
shape4.thatsRotated(45).withFlippedY.thatsTranslated(120, 40).thatsFilledWith(cm.purple),
shape7.thatsRotated(45).thatsTranslated(120, -110).thatsFilledWith(ColorMaker.hsl(183, 1.00, 0.50)),
shape6.thatsRotated(45).withFlippedX.thatsTranslated(120, -180).thatsFilledWith(green)
)
def butterfly = picStack(
Picture{},
shape1.thatsFilledWith(yellow).thatsRotated(-135)thatsTranslated(0, 120),
shape7.thatsFilledWith(blue).thatsRotated(135).thatsTranslated(0, 50),
shape6.thatsFilledWith(green).thatsRotated(135).withFlippedX.thatsTranslated(0, 50),
shape3.thatsFilledWith(cm.green).thatsRotated(45).thatsTranslated(70, 50),
shape4.thatsFilledWith(cm.orange).thatsRotated(-45).thatsTranslated(70, -20),
shape4.thatsFilledWith(purple).thatsRotated(-135).thatsTranslated(140, 120),
shape1.thatsFilledWith(red).thatsRotated(-45).thatsTranslated(140, 120)
)
def triangle = picStack(
Picture{},
shape1.thatsRotated(180).thatsFilledWith(red),
shape1.thatsRotated(180).thatsFilledWith(yellow).thatsTranslated(0, 200),
shape3.thatsFilledWith(cm.green).thatsTranslated(0, 100),
shape4.thatsRotated(90).thatsTranslated(-50, 50).thatsFilledWith(cm.orange),
shape6.withFlippedX.thatsFilledWith(green).thatsTranslated(0, 100),
shape4.withFlippedY.thatsFilledWith(purple).thatsTranslated(0, 100),
shape7.thatsTranslated(100, 100).thatsFilledWith(ColorMaker.hsl(193, 1.00, 0.50))
)
//triangle.draw
def heart = picStack(
Picture{},
shape1.thatsRotated(90).thatsFilledWith(red),
shape1.thatsRotated(-90).thatsFilledWith(yellow).thatsTranslated(0, 200),
shape3.thatsFilledWith(cm.green).thatsTranslated(100, 200),
shape4.thatsRotated(180).thatsTranslated(100, 0).thatsFilledWith(cm.orange),
shape6.withFlippedX.thatsFilledWith(green).thatsTranslated(150, 50),
shape4.thatsRotated(-90).thatsFilledWith(purple).thatsTranslated(150, 150),
shape7.withFlippedX.thatsTranslated(0, 0).thatsFilledWith(ColorMaker.hsl(193, 1.00, 0.50))
)
def mountain = picStack(
Picture{},
shape1.thatsRotated(135).thatsFilledWith(red),
shape1.thatsRotated(45).thatsFilledWith(yellow).thatsTranslated(140, 0),
shape3.thatsFilledWith(cm.green).thatsTranslated(70, 150),
shape4.thatsRotated(135).thatsTranslated(140, 0).thatsFilledWith(cm.orange),
shape6.thatsRotated(135).withFlippedX.thatsFilledWith(green).thatsTranslated(0, 70),
shape4.thatsRotated(135).thatsFilledWith(purple).thatsTranslated(70, 0),
shape7.thatsRotated(-45).thatsTranslated(140, 0).thatsFilledWith(ColorMaker.hsl(193, 1.00, 0.50))
)
fish.thatsScaled(0.5).thatsTranslated(-300, 200).draw
bird.thatsScaled(0.5).thatsTranslated(-100, 180).draw
tree.thatsScaled(0.5).thatsTranslated(150, 170).draw
dog.thatsScaled(0.5).thatsTranslated(-300, 0).draw
boat.thatsScaled(0.5).thatsTranslated(-100, 50).draw
butterfly.thatsScaled(0.5).thatsTranslated(150, 0).draw
triangle.thatsScaled(0.5).thatsTranslated(-250, -250).draw
heart.thatsScaled(0.5).thatsTranslated(-50, -250).draw
mountain.thatsScaled(0.5).thatsTranslated(150, -250).draw