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();
}
void loop()
{
background(127);
if (test.currentRepetition() % 2 == 1)
test.setImageHeight(30); // make image 30px high
else
test.setImageHeight(10); // make image 10px high
test.draw();
float img_height = test.imageHeight();
text("Image height is " + img_height + " pixels.", 25, 25);
}
|