Plushie.Animation.Sequence (Plushie v0.6.0)

Copy Markdown View Source

Renderer-side sequential animation chain.

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

Usage

# List form
opacity: sequence([
  transition(200, to: 1.0, from: 0.0),
  loop(800, to: 0.7, from: 1.0, cycles: 3),
  transition(300, to: 0.0)
])

# Do-block form
opacity: sequence do
  transition(200, to: 1.0, from: 0.0)
  loop(800, to: 0.7, from: 1.0, cycles: 3)
  transition(300, to: 0.0)
end

Completion

Only the sequence-level on_complete: fires. Individual step completion tags are ignored.

opacity: sequence([
  transition(200, to: 1.0, from: 0.0),
  transition(300, to: 0.0)
], on_complete: :fade_cycle_done)

Summary

Functions

Creates a new sequence from a list of transition/spring steps.

Sets the completion event tag.

Types

step()

t()

@type t() :: %Plushie.Animation.Sequence{on_complete: atom() | nil, steps: [step()]}

Functions

new(steps, opts \\ [])

@spec new(steps :: [step()], opts :: keyword()) :: t()

Creates a new sequence from a list of transition/spring steps.

Sequence.new([
  Transition.new(200, to: 1.0, from: 0.0),
  Transition.new(300, to: 0.0)
])

Sequence.new([...], on_complete: :done)

on_complete(s, tag)

@spec on_complete(sequence :: t(), tag :: atom()) :: t()

Sets the completion event tag.