Animation Overview - News - Installation - Reference - Examples - FAQ  
 

currentPercentage()

Description Returns the percentage complete that an Animation is at the time of the call.
Prototype

float currentPercentage();

Parameters   (none)
Return float Returns the percent complete. The percentage 25% returns as 0.25 .
Example

 

Animation test;
BFont font;

void setup()
{
  size(400,100);
  font = loadFont("RotisSanSer.vlw.gz");
  textFont(font, 20);
  
  test = new Animation(this, loadImage("image.gif"), 100,40, 200,40);
  test.showRectangle();
  test.setDuration(5000);
}

void loop()
{
  background(127);
  test.draw();
  float p = test.currentPercentage(); // get current % complete.
  text("Animation is " + p + " complete.", 25, 25);
}