Code Sketch


Fish Tangram
By: Marcelia Pinto
Category: Programming
clear
showAxes()
showGrid()

fish.draw

def fish = picStack(
    //Picture {},
    square.thatsFilledWith(Color(255, 255, 0)).thatsRotated(45).thatsTranslated(70, 65),
    triangle1.thatsFilledWith(Color(204, 102, 0)).thatsRotated(-45).thatsTranslated(70, 1.2),
    triangle2.thatsFilledWith(Color(255, 153, 0)).thatsRotated(-135),
    triangle2.thatsFilledWith(Color(0, 204, 0)).thatsRotated(45).withFlippedX,
    triangle3.thatsFilledWith(purple).thatsTranslated(55, -140).thatsRotated(-135).withFlippedX,
    parallelogram.thatsFilledWith(Color(0, 47, 164)).thatsTranslated(-55, -45).thatsRotated(135),
    triangle4.thatsFilledWith(Color(255, 0, 0)).thatsRotated(135).thatsTranslated(-0.1, 135),
)

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(noColor)

def triangle1 = Picture {
    right()
    forward(100)
    left(135)
    forward(70.71)
    left(90)
    forward(70.71)
}.thatsStrokeColored(noColor)

def triangle2 = Picture {
    right(135)
    forward(141.42)
    left(135)
    forward(200)
    left(135)
    forward(141.42)
}.thatsStrokeColored(noColor)

def triangle3 = Picture {
    left(45)
    forward(70.71)
    left(135)
    forward(100)
    left(135)
    forward(70.71)
}.thatsStrokeColored(noColor)

def parallelogram = Picture {
    forward(100)
    right(135)
    forward(70.71)
    right(45)
    forward(100)
    right(135)
    forward(70.71)
}.thatsStrokeColored(noColor)

def triangle4 = Picture {
    left(45)
    forward(142.14)
    left(135)
    forward(100)
    left(90)
    forward(100)
}.thatsStrokeColored(noColor)