pub fn resolve_frame(
diff: f32,
start: i32,
end: i32,
loops: i32,
style: PlaybackStyle,
direction: PlaybackDirection,
) -> (f32, bool)Expand description
Pure, deterministic mapping from “frames elapsed since playback started”
(diff, with per-instance speed already applied) to the resolved
playback frame within the inclusive [start, end] range, applying loop
count and playback style / direction. Matches SpriteStudio 6 SDK’s
SsAnimeDecoder::updateInstance semantics, including the inclusive
inst_scale = (end - start) + 1 cycle length and the duplicated peak /
trough frames at PingPong reversal boundaries.
Returns (frame, finished) where finished is true once the
configured loops have completed. For loops == -1 (infinite) and
loops == 0 (treated as infinite to match PlaybackController::update)
finished is always false. diff < 0 is clamped to 0.
loops > 0 defines total cycles. A “cycle” is (end - start) + 1
frames for Normal and 2 * ((end - start) + 1) frames for PingPong
(one full there-and-back, with the turn-around frame appearing in both
halves to match SS6).