Example |
Animation a_normal;
Animation a_regpointed;
BImage img;
BFont font;
void setup()
{
size(450,250);
font = loadFont("RotisSanSer.vlw.gz");
textFont(font, 20);
img = loadImage("image.gif");
// setup a_normal
a_normal = new Animation(this, img, 50,50, 100, 50);
a_normal.setStep("BOX");
a_normal.setDuration(5000);
a_normal.showRectangle();
// setup a_regpointed
a_regpointed = new Animation(this, img, 50,150, 100,50);
a_regpointed.setStep("BOX");
a_regpointed.setDuration(5000);
a_regpointed.showRectangle();
// set registration point to the middle of the image.
a_regpointed.setRegistrationPoint(img.width/2, img.height/2);
}
void loop()
{
background(127);
fill(255);
text("Normal animation (registration point at image's top-left corner).", 25, 40);
text("Animation with registration point at image's center.", 25, 140);
noFill();
a_normal.draw();
a_regpointed.draw();
}
|