animate.frink

View or download animate.frink in plain text format


// Simple animation test.

// Start out with an undefined window.  This will get defined the first
// time we call graphics.show[].
win = undef

while (true)
{
   for x = 0 to 10 step .01
   {
      // Create a new graphics object for each frame.
      g = new graphics

      // Draw 3 circles
      g.color[1,0,0, .8]
      g.fillEllipseCenter[sin[x],cos[x],1,1]

      g.color[1,1,0,.7]
      g.fillEllipseCenter[x,sin[x],.9,.9]

      g.color[0,0,1,.5]
      g.fillEllipseCenter[x/2,0,1.1,1.1]

      // If this is the first frame, show it and save the window.
      if (win == undef)
         win = g.show[]
      else
         win.replaceGraphics[g] // Not first frame, replace graphics.

      sleep[1/30 s]
   }

   // Pause before restarting animation.
   sleep[2 s]
}


View or download animate.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17360 days, 18 hours, 57 minutes ago.