Code Sketch


Indian Flag- Saanvi Mahesh Madgaonkar
By: Saanvi Mahesh Madgaonkar
Category: Art
cleari()

setPosition(0,0)
setPenColor(black)


def ashokaChakraSpokes(steps:Int):Unit=
    
    if(steps==0)
    {
        ()
    }
    else
    {
        
    forward(22)
    forward(-22)
    right(15)
    ashokaChakraSpokes(steps-1)
    }
def chakra= Picture{
    
ashokaChakraSpokes(24)
}


def curve= Picture.fromVertexShape{
    x=>
        setPenColor(black)
        x.beginShape()
        x.vertex(0,200)   

         x.bezierVertex(
          71,225,
          200,177,  
        250,200    
      )
      x.vertex(250,150)
      x.bezierVertex(
          200,127,
          71, 175,
          0,150   
      )
       x.vertex(0,200) 
        x.endShape()
}

curve.draw
def rectangle()=Picture.rect(400,10)

def flag=picStack(
   
    curve.thatsFilledWith(cm.radialGradient(0,0, Color(255, 51, 0), 100, orange, true)
),

    curve.thatsTranslated(0,-50).thatsFilledWith(cm.radialGradient(0, 0, (white), 100, Color(204, 204, 204), true)
),

    curve.thatsTranslated(0,-100).thatsFilledWith(cm.radialGradient(0, 0, (green), 100, Color(51, 102, 0), true)
)

    )
    flag.thatsStrokeColored(black).draw
    rectangle.thatsTranslated(0,-200).thatsFilledWith(cm.radialGradient(0, 0,(Color(153, 51, 0) ), 100,(Color(51, 0, 0)), true)
).thatsStrokeColored(black).draw
def circle=Picture.circle(22)

 
def rectangle1=Picture.rect(30,150)

rectangle1.thatsTranslated(-60, -230)
.thatsFilledWith(Color(125, 85, 46)).thatsStrokeColored(black).draw
rectangle1.thatsTranslated(-65, -210).thatsScaled(1.3)
.thatsFilledWith(Color(88, 54, 25)
)
def ashokChakra=picStack(
    circle,
    chakra
    )
    ashokChakra.thatsTranslated(120,127).thatsStrokeColored(blue).draw