API Reference › Anim › Anim.finished
method

Anim.finished

Anim.finished(timer, fps, count) -> bool

Returns true once floor(timer * fps) >= count — i.e. a one-shot clip driven by Anim.once has played its final frame. Use it to despawn an effect, fire a follow-up, or switch back to an idle clip.

Parameters

timerelapsed seconds (a fixed)
fpsframes per second
countnumber of frames in the clip

Example

program Demo {
  property Blast { timer: fixed = 0.0 }
  model Boom { Blast }
  handler Run phase Update {
    Blast.timer = Blast.timer + Time.delta()
    if Anim.finished(Blast.timer, 15, 6) { despawn (self()) }
  }
}
← All symbols