plushie/animation/sequence

Renderer-side sequential animation chain.

Chains multiple transitions and springs that execute one after another on the same prop. Each step’s starting value defaults to the previous step’s final value if not specified.

Usage

import plushie/animation/sequence
import plushie/animation/spring
import plushie/animation/transition

// Fade in, pulse three times, then fade out
sequence.new()
|> sequence.then_transition(
  transition.new(to: 1.0, duration: 200)
  |> transition.from(0.0),
)
|> sequence.then_spring(spring.bouncy(0.7))
|> sequence.then_transition(
  transition.new(to: 0.0, duration: 300),
)
|> sequence.on_complete("fade_cycle_done")

Types

A sequential animation chain.

pub opaque type Sequence

A step in the animation sequence, holding an already-encoded descriptor (transition or spring).

pub opaque type Step

Values

pub fn encode(seq: Sequence) -> node.PropValue

Encode a sequence to its wire-format PropValue.

pub fn new() -> Sequence

Create an empty sequence. Add steps with then_transition and then_spring.

pub fn on_complete(seq: Sequence, tag: String) -> Sequence

Set the completion event tag for the entire sequence.

Only the sequence-level tag fires. Individual step completion tags are ignored by the renderer.

pub fn then_spring(seq: Sequence, s: spring.Spring) -> Sequence

Append a spring step to the sequence.

pub fn then_transition(
  seq: Sequence,
  t: transition.Transition,
) -> Sequence

Append a transition step to the sequence.

Search Document