Code Sketch


star
By: Sampada Dhupkar
cleari()
showAxes()

 def gradients = 
    cm.linearMultipleGradient(
        0,307,
        0,-307,
        Seq(0,0.5,1),
        Seq(blue,white,green),
        false
)
setBackground(gradients)

def shape = 
    Picture.fromVertexShape { x =>
        x.beginShape()
        
        x.vertexRt(150, 0)
        x.vertexRt(150, 72*2)
        x.vertexRt(150, 72*4)
        x.vertexRt(150, 72*6)
        x.vertexRt(150, 72*8)
        x.vertexRt(150, 72*10 )
        
        x.endShape()
    }

def shape1 = 
    Picture.fromVertexShape { x =>
        x.beginShape()
        
        x.vertexRt(150, 0)
        x.vertexRt(150, 72)
        x.vertexRt(150, 72*2)
        x.vertexRt(150, 72*3)
        x.vertexRt(150, 72*4)
        x.vertexRt(150, 72*5 )
        
        x.endShape()
    }

animateWithState(0) { 
    case angle =>
        erasePictures()
        shape.thatsRotated(angle)
        .thatsFilledWith(red).draw
        angle+1
    
}