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

repetitions()

Description Returns the number of repetitions an Animation will perform before ending. (A return value of 0 means the Animation will repeat forever.) To set this parameter, use setRepetitions().
Prototype

long repetitions();

Parameters   (none)
Return long Number of repetitions the Animation will perform. (0 means the Animation will repeat forever.)
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.setRepetitions(10);
}

void loop()
{
  background(127);
  test.draw();
  long repetitions = test.repetitions(); // get number of repetitions to perform
  text("This Animation will repeat " + repetitions + " times before stopping.", 25, 25);
}