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

setFrames()

Description

Sets the duration of an Animation, in frames. Setting a duration overrides any previously set duration, including one defined by setDuration().

(Frame rate can be controlled using Processing's framerate() method.)

To retrieve the percentage complete that the Animation is, use currentPercentage().

Prototype

setFrames(count);

Parameters count Number of frames it takes to complete one repetition of the Animation.
Return   (none)
Example

 

 

 

Animation test;

void setup()
{
  size(400,100);
  test = new Animation(this, loadImage("image.gif"), 100,40, 200,40);
  test.showRectangle();

  framerate(1); // draw one frame per second
  test.setFrames(10); // animation will take ten frames.
}

void loop()
{
  background(127);
  test.draw();
}