Code Sketch


TANGRAM
By: Ayaan Sayed
Category: Art
cleari 
//showGrid()
// showAxes()

tangram.draw

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 square = Picture{
        right(135)
        forward(70.71)
        right(90)
        forward(70.71)
        right(90)
        forward(70.71)
    }.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)