Animation.getDelay

From Spheriki

Jump to: navigation, search

Returns the delay between the animation's frames, in milliseconds.


Contents

Usage

number Animation.getDelay();


Examples

Animate an animation, including frame timing (delays).

var anim = LoadAnimation("file.mng");
var delay = anim.getDelay();
var prevtime = GetTime();

while (true)
{
  if (GetTime() > prevtime+delay)  //What if the current frame's time is over?
  {
    delay = anim.getDelay();
    prevtime = GetTime();
    anim.readNextFrame();  //Go to next frame.
  }
  
  anim.drawFrame(20, 20);
  FlipScreen();
}


Notes

May or may not work with MNG animations.


See also

Personal tools