method
Tween.yoyo
Tween.yoyo(timer, duration) -> fixed
Returns a triangle wave: timer / duration ramps 0.0→1.0 over the first duration, then 1.0→0.0 over the next, and repeats. The smooth back-and-forth for a hover bob, a pulsing highlight, or a breathing scale — no snap at the ends the way Tween.loop has.
Parameters
timerelapsed seconds (a fixed)durationseconds for each leg (a fixed)Example
program Demo {
property Bob { timer: fixed = 0.0 }
model Pickup { Bob }
handler Run phase Update {
Bob.timer = Bob.timer + Time.delta()
let t = Tween.yoyo(Bob.timer, fixed(1))
let y = Tween.round(100, 108, Tween.ease(t, 3))
print(y)
}
}