Code Sketch


Bird
By: Anirudh Shetgaonkar
Category: Programming
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)

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

def tangram = picStack(
    Picture {},
    shape3.thatsFilledWith(red).thatsRotated(-45),
    shape7.thatsFilledWith(blue).thatsRotated(135),
    shape6.thatsFilledWith(green).withFlippedY.thatsRotated(90).thatsTranslated(50, -50),
    shape5.thatsFilledWith(yellow).thatsRotated(45).thatsTranslated(-70, 0),
    shape4.thatsFilledWith(Color(255, 51, 255)).thatsTranslated(-240, 0),
    shape1.thatsFilledWith(Color(0, 255, 204)).thatsRotated(-90).thatsTranslated(-40, 100),
    shape1.thatsFilledWith(Color(255, 204, 204)).withFlippedY.thatsTranslated(0, -60).thatsRotated(90)
)

tangram.draw