method
Tween.loop
Tween.loop(timer, duration) -> fixed
Returns the fractional part of timer / duration — a sawtooth that ramps 0.0→1.0 then jumps back to 0.0 and repeats. Use it for a continuously cycling value: a scrolling offset, a rotating hue, a repeating pulse.
Parameters
timerelapsed seconds (a fixed)durationseconds per cycle (a fixed)Example
program Demo {
property Spin { timer: fixed = 0.0 }
model Coin { Spin }
handler Run phase Update {
Spin.timer = Spin.timer + Time.delta()
let t = Tween.loop(Spin.timer, fixed(2)) # a 2-second cycle
print(t)
}
}