API Reference › Tween › Tween.progress
method

Tween.progress

Tween.progress(timer, duration) -> fixed

Returns timer / duration clamped to 0.0..1.0 — the normalized progress of a one-shot tween. Feed it to Tween.ease to shape it, then to a typed blend. Once timer reaches duration it pins at 1.0 (a non-positive duration also reads as done).

Parameters

timerelapsed seconds (a fixed)
durationthe tween's length in seconds (a fixed)

Example

program Demo {
  property Fade { timer: fixed = 0.0 }
  model Panel { Fade }
  handler Run phase Update {
    Fade.timer = Fade.timer + Time.delta()
    let t = Tween.progress(Fade.timer, fixed(1))
    let a = Tween.round(0, 255, Tween.ease(t, 2))
    print(a)
  }
}
← All symbols