← back to roto on ba3a.dev

FlipbookClock

Which frame shows at a time. Integer arithmetic only; the app feeds elapsed time in, so no wall clock is read here.

Functions

Link copied to clipboard
fun frameAt(elapsedMs: Long, durations: List<Int>, loop: Boolean): Int

The index of the frame showing elapsedMs after the start, for frames shown for durations milliseconds each. A frame starts exactly at the sum of the durations before it. With loop the time wraps over the total; without it, time past the end stays on the last frame. A negative time counts as zero.