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

currentY()

Description Returns the y-component of the current location of the Animation target (be it an image or another Animation).
Prototype

float currentY();

Parameters   (none)
Return float Y-component of current Animation target's location.
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();
  test.setDuration(5000);
}

void loop()
{
  background(127);
  test.draw();
  float y = test.currentY(); // get y-component of current position
  text("Current y position: " + y,25,25);
}