Constructor which creates a new Animation
object. By default, the Animation repeats forever and each repetition
lasts one second. The default motion is a straight diagonal across
the animation-rectangle.
Prototype
Animation(this, image, x, y, w, h);
Animation(this, animation, x, y, w, h);
Parameters
this
Reference to the calling sketch. Should
be passed in just this manner: pass "this" as the first
parameter.
image or animation
A BImage. The image to animate.
Another Animation object, to which this Animation applies its motion.
x
int or float, describing the upper-left x position
of the animation-rectangle in pixels.
y
int or float, describing the upper-left y position
of the animation-rectangle in pixels.
w
int or float, describing the width of the animation-rectangle
in pixels.
h
int or float, describing the height of the animation-rectangle
in pixels.
Return
(none)
Example
Animation test;
void setup()
{
size(400,100);
BImage image = loadImage("image.gif");
test = new Animation(this, image, 100,40, 200,40); // create a new Animation.
test.showRectangle();
}
void loop()
{
background(127);
test.draw();
}