Sets the location and size of the animation-rectangle.
A rectangle must be set up in the constructor; this method simply
allows it to be changed later.
To retrieve the dimensions of an Animation's rectangle, use x(),
y(), w() and h().
Prototype
setRectangle(x, y, w, h);
Parameters
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);
test = new Animation(this, loadImage("image.gif"), 0,0, 100,100);
test.showRectangle();
}
void loop()
{
// change rectangle position to (250,10) with width=100, height=50.
test.setRectangle(250,10, 100,50);
background(127);
test.draw();
}