an.adapters.cutout.clip

Clip: a named bundle of channels with a duration and loop mode.

A clip is what you’d call an “animation” in Spine / Rive terminology — a reusable unit (e.g. "walk_cycle", "wave"). Evaluating a clip at time t produces a Pose by evaluating each of its channels at t.

Loop modes:

  • LoopMode.ONCE — past duration, the last frame holds.

  • LoopMode.LOOPt wraps modulo duration.

  • LoopMode.PING_PONGt ping-pongs over [0, duration].

>>> from an.adapters.cutout.channel import Channel, Keyframe
>>> ch = Channel("a", "x", [Keyframe(0.0, 0.0), Keyframe(1.0, 10.0)])
>>> clip = Clip("walk", duration=1.0, channels=[ch], loop_mode=LoopMode.LOOP)
>>> evaluate(clip, 0.5)[("a", "x")]
5.0
>>> evaluate(clip, 1.25)[("a", "x")]  # loop wraps
2.5
class an.adapters.cutout.clip.Clip(name: str, duration: float, channels: list[~an.adapters.cutout.channel.Channel] = <factory>, loop_mode: ~an.adapters.cutout.clip.LoopMode = LoopMode.ONCE)[source]

Named animation: a duration + a bundle of channels.

class an.adapters.cutout.clip.LoopMode(value)[source]

How a clip behaves past its natural duration.

an.adapters.cutout.clip.evaluate(clip: Clip, t: float) dict[tuple[str, str], Any][source]

Evaluate clip at time t, returning a Pose.