method
Math.ping_pong
Math.ping_pong(t, len) -> int
Maps an ever-increasing counter t to a value that rises from 0 to len and back, bouncing forever — the triangle wave to Math.wrap's sawtooth. Feed it a frame counter to drive a patrol, a pulsing highlight, or a back-and-forth sweep without tracking direction yourself.
Example
program Demo {
handler Step phase Update {
let phase = Math.ping_pong(frame, 30)
}
}