Code Sketch


Tangram 1
By: Savita K. Manerikar
cleari

//showAxes()
//showGrid()
//def colors =
    cm.linearGradient(
        99, 0, 
        Color(8, 112, 193), 
        50, 300, 
        Color(0, 221, 113), 
        false)
    

//setBackground(colors)



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 boat = picStack(
    Picture {},
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(70, -70),
shape7.thatsFilledWith(red).thatsRotated(45).thatsTranslated(210, 0),
shape5.thatsRotated(90).thatsFilledWith(Color(0, 154, 15)).thatsTranslated(160, 50),
shape3.thatsFilledWith(Color(0, 169, 239)).thatsTranslated(210, 100),
shape7.thatsFilledWith(orange).thatsRotated(-90).thatsTranslated(110, 0),
shape5.thatsFilledWith(green).thatsTranslated(160, 150), 
shape5.thatsFilledWith(Color(255, 217, 119)).thatsRotated(-45).thatsTranslated(110, 10),  
    
)

def rocket = picStack(
    Picture {},
    shape5.thatsFilledWith(green).thatsRotated(180).thatsTranslated(0, -150),
    shape7.thatsFilledWith(red).thatsTranslated(150, -200),
    shape1.thatsFilledWith(orange).thatsRotated(90).thatsTranslated(150, -200),
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(-90).thatsTranslated(250, -100),
    
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsTranslated(300, -50),
    shape5.thatsRotated(-90).thatsFilledWith(Color(0, 154, 15)).thatsTranslated(350, -100),
  shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(350, -270),
    
)
def p3 = picStack(
    Picture {},
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(-350, -70),
    shape1.thatsFilledWith(orange).thatsRotated(90).thatsTranslated(-250, -100),
    shape7.thatsFilledWith(red).thatsRotated(90).thatsTranslated(-150, 100),
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(90).thatsTranslated(-250, 0),
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsTranslated(-350, -70),
   shape5.thatsFilledWith(green).thatsRotated(180).thatsTranslated(-270, -120),
   shape5.thatsRotated(-90).thatsFilledWith(Color(0, 154, 15)).thatsRotated(90).thatsTranslated(-170, -120),
)

def p4 = picStack(
    Picture {},
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(480, 0),
    shape5.thatsRotated(-90).thatsFilledWith(Color(0, 154, 15)).thatsRotated(135).thatsTranslated(550, 70),
    shape7.thatsFilledWith(red).thatsRotated(-90).thatsTranslated(550, 0),
    shape1.thatsFilledWith(orange).thatsRotated(-90).thatsTranslated(650, 100),
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(90).thatsTranslated(750, 0),
    shape5.thatsFilledWith(green).thatsRotated(90).thatsTranslated(600, 150),
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsTranslated(600, 250),
    )


def p5 = picStack(
    Picture {},
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(90).thatsTranslated(0, 300),
    shape5.thatsFilledWith(Color(0, 154, 15)).thatsRotated(90).thatsTranslated(50, 350),
   shape1.thatsFilledWith(orange).thatsRotated(-135).thatsTranslated(190, 350),
   shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(45).thatsTranslated(50, 350),
   shape3.thatsFilledWith(Color(0, 169, 239)).thatsRotated(45).thatsTranslated(190, 350),
   shape5.thatsFilledWith(green).thatsRotated(135).thatsTranslated(260, 350),
   shape7.thatsFilledWith(red).thatsRotated(90).thatsTranslated(330, 450),
   )

    def p6 = picStack(
    Picture {},
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(450, 280),
    shape7.thatsFilledWith(red).thatsRotated(45).thatsTranslated(590, 350),
    shape5.thatsFilledWith(Color(0, 154, 15)).thatsRotated(-45).thatsTranslated(590, 280),
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsRotated(45).thatsTranslated(590, 350),
    shape5.thatsFilledWith(green).thatsRotated(135).thatsTranslated(660, 350),
    shape1.thatsFilledWith(orange).thatsRotated(180).thatsTranslated(580, 450),
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(180).thatsTranslated(700, 450),
    )
    
    def p7 = picStack(
    Picture {},
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(90).thatsTranslated(-480, 200),
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsRotated(45).thatsTranslated(-480, 370),
    shape1.thatsFilledWith(orange).thatsRotated(-90).thatsTranslated(-380, 300),
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(45).thatsTranslated(-280, 200),
    shape7.thatsFilledWith(red).thatsRotated(45).thatsTranslated(-140, 270),
    shape5.thatsFilledWith(Color(0, 154, 15)).thatsRotated(-45).thatsTranslated(-140, 200),
    shape5.thatsFilledWith(green).thatsRotated(135).thatsTranslated(-140, 270),
     )

    def p8 = picStack(
    Picture {},
    shape3.thatsFilledWith(Color(0, 169, 239)).thatsTranslated(-540, 540),
    shape5.thatsFilledWith(green).thatsRotated(-90).thatsTranslated(-460, 420),
    shape5.thatsFilledWith(Color(0, 154, 15)).thatsRotated(90).thatsTranslated(-410, 470),
    shape1.thatsFilledWith(orange).thatsTranslated(-410, 470),
    shape7.thatsFilledWith(red).thatsRotated(-135).thatsTranslated(-450, 570),
    shape1.thatsFilledWith(Color(255, 217, 119)).thatsRotated(180).thatsTranslated(-210, 470),
    shape6.thatsFilledWith(Color(0, 53, 11)).thatsRotated(-90).thatsTranslated(-260, 620),
    )
    
boat.draw
rocket.draw
p3.draw
p4.draw
p5.draw
p6.draw
p7.draw
p8.draw