Animation Overview - News - Installation - Reference - Examples - FAQ  
 

y()

Description Returns the upper-left y component of an Animation-rectangle's position. To set this parameter outside the constructor, use setRectangle().
Prototype

float y();

Parameters   (none)
Return float Upper-left y component of the rectangle's position, in pixels.
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);
test.draw();
float y = test.y(); // retrieve y-component of animation-rectangle's upper-left corner.
text("This animation-rectangle begins at y=" + y + ".", 25, 25);
}