Example |
Animation test;
Animation a_box;
Animation an_ellipse;
void setup()
{
size(400,100);
a_box = new Animation(this, loadImage("image.gif"), 0,0, 20,20);
a_box.setStep("BOX");
a_box.showRectangle();
an_ellipse = new Animation(this, loadImage("image.gif"), 0,0, 10,-40);
an_ellipse.setStep("ELLIPSE");
an_ellipse.showRectangle();
test = new Animation(this, a_box, 100,40, 200,40);
test.setDuration(10000);
test.showRectangle();
}
void loop()
{
background(127);
if (test.currentPercentage() < 0.5)
test.setAnimation(a_box); // set nested animation to the box.
else
test.setAnimation(an_ellipse); // set nested animation to the ellipse.
test.draw();
}
|