Code Sketch


Butterfly
By: Sonal Vaze
cleari

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)
.thatsFilledWith(color(7, 204, 8))

def shape7 = Picture {
    left(45)
    forward(141.42)
    left(135)
    forward(100)
    left(90)
    forward(100)
}.thatsStrokeColored(black)

def tangram = picStack(
     Picture {},
        shape3.thatsRotated(45). thatsTranslated(0,70)
               .thatsFilledWith(green),
               
        shape1.thatsRotated(45).thatsTranslated(-72, 0) 
               .withFlippedY.thatsFilledWith(red) 
               .thatsTranslated(143, 140),

        shape6.thatsRotated(135).thatsTranslated(0, -70)
               .withFlippedY,

        shape1.thatsFilledWith(yellow). thatsRotated(135)
                .withFlippedY.thatsTranslated(-72, 140),

           
        shape7.thatsRotated(135).thatsTranslated(-72, 70)
               .thatsFilledWith(Color(0, 180, 183)),
               
         shape4.thatsRotated(135).thatsTranslated(0, 70)
                .withFlippedX
                .thatsFilledWith(Color(175, 0, 255)),
    
         shape4.thatsRotated(315) 
                .thatsFilledWith(Color(204, 102, 0))

 
)

tangram.draw