Skip to content

Instantly share code, notes, and snippets.

@julsam
Created April 2, 2011 19:08
Show Gist options
  • Save julsam/899772 to your computer and use it in GitHub Desktop.
Save julsam/899772 to your computer and use it in GitHub Desktop.
flash punk
/** @private Updates the animation. */
override public function update():void
{
if (_anim && !complete)
{
_timer += (FP.fixed ? _anim._frameRate : _anim._frameRate * FP.elapsed) * rate;
if (_timer >= 1)
{
while (_timer >= 1)
{
_timer --;
_index ++;
if (_index == _anim._frameCount)
{
if (_anim._loop)
{
_index = 0;
if (callback != null) callback();
}
else
{
_index = _anim._frameCount - 1;
complete = true;
if (callback != null) callback();
break;
}
}
}
if (_anim) _frame = uint(_anim._frames[_index]);
updateBuffer();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment