Code Sketch


Butterfly Tangram
By: Manjusha Govekar
cleari

//TangramButterfly

//showAxes()
//showGrid()


tangram.draw

def tangram = picStack(
    Picture {},
    
    square.thatsFilledWith(Color(0, 125, 44)).thatsRotated(45).thatsTranslated(05, 70),

    triangle1.thatsFilledWith(Color(205, 135, 52)).thatsRotated(45).withFlippedX.thatsTranslated(75, -70),

    triangle2.thatsFilledWith(red).thatsRotated(-45).thatsTranslated(75, 143),

    triangle2.thatsFilledWith(yellow).thatsRotated(90+135).thatsTranslated(-65, 142),

    triangle3.thatsFilledWith(ColorMaker.hsl(297, 0.57, 0.49)).thatsRotated(45).withFlippedY.thatsTranslated(76, 72.05),

    parallelogram.withFlippedY.thatsFilledWith(Color(0, 197, 103)).thatsRotated(45).thatsTranslated(-65, 70),

    triangle4.thatsFilledWith(Color(0, 122, 202)).thatsRotated(135).thatsTranslated(-65, 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)