Skip to main content

apply_pingpong

Function apply_pingpong 

Source
pub fn apply_pingpong<T: Clone>(frames: &[T], exclude_ends: bool) -> Vec<T>
Expand description

Apply pingpong transform: duplicate frames in reverse order for forward-backward play.

Given frames [A, B, C], produces:

  • exclude_ends=false: [A, B, C, C, B, A]
  • exclude_ends=true: [A, B, C, B]

§Arguments

  • frames - The animation frames (sprite names)
  • exclude_ends - If true, don’t duplicate first/last frame in reverse

§Returns

A new Vec with the pingpong sequence