Example |
Animation test;
BImage img;
BFont font;
void setup()
{
size(400,100);
font = loadFont("RotisSanSer.vlw.gz");
textFont(font, 20);
img = loadImage("image.gif");
test = new Animation(this, img, 100,40, 200,40);
test.setStep("BOX");
test.setDuration(5000);
test.showRectangle();
test.setRegistrationPoint(img.width*1/2, img.height*1/2);
}
void loop()
{
background(127);
fill(255);
float reg_y = test.currentRegistrationPointY(); // retrieve y-component of reg point.
text("Registration point at y=" + reg_y, 25, 25);
noFill();
test.draw();
}
|