Code Sketch


Episode 7: Make the real Sun glow in our drawing! Flying birds with Arcs
By: Clinton J. Fernandes
Category: Programming
clear()
setSpeed(fast)

setBackground(cm.radialGradient(4,-3,red,115,Color(254, 250, 50), false))
val x = Array(10,20,40,60)
setPosition(0,110)
setPosition(-450,100)

def birds = Picture.fromPath { x =>
    x.moveTo(0,0)
    x.arc(-135,68,120)
    x.moveTo(0,0)
    x.arc(135, 68, -120)
}.thatsStrokeColored(black)

def birds(count:Long):Picture =
if (count==1) 
    {
        birds
    }
else

    {
def iHave=birds
def giveMe=birds(count-1)

   picStack (
   iHave,
   giveMe
  .thatsScaled(0.6)
  .thatsTranslated(100, 125)
   ) 
    }

birds(10).draw()