plushie/animation/transition

Renderer-side timed transition descriptor.

Declares animation intent in the view; the renderer handles interpolation locally with zero wire traffic during animation.

Usage

import plushie/animation/transition

// Basic fade out
transition.new(to: 0.0, duration: 300)

// With easing and delay
transition.new(to: 0.0, duration: 300)
|> transition.easing(easing.EaseOut)
|> transition.delay(100)

// Enter animation (fade in from transparent)
transition.new(to: 1.0, duration: 200)
|> transition.from(0.0)

// Infinite loop (pulse)
transition.loop(to: 0.4, from: 1.0, duration: 800)

Types

How a transition repeats.

pub type Repeat {
  Times(Int)
  Forever
}

Constructors

  • Times(Int)

    Repeat a fixed number of times.

  • Forever

    Repeat indefinitely.

A timed transition descriptor. All fields except to and duration have sensible defaults.

pub opaque type Transition

Values

pub fn auto_reverse(
  t: Transition,
  auto_reverse: Bool,
) -> Transition

Set whether the animation reverses on each repeat cycle.

pub fn delay(t: Transition, delay: Int) -> Transition

Set the delay before the transition starts (milliseconds).

pub fn easing(t: Transition, easing: easing.Easing) -> Transition

Set the easing curve.

pub fn encode(t: Transition) -> node.PropValue

Encode a transition to its wire-format PropValue.

Only non-default fields are included to keep messages compact.

pub fn from(t: Transition, from: Float) -> Transition

Set the explicit start value (for enter animations and loop reset).

pub fn loop(
  to to: Float,
  from from: Float,
  duration duration: Int,
) -> Transition

Create a looping transition that repeats forever with auto-reverse.

from sets the cycle start value, to sets the cycle end value.

pub fn new(to to: Float, duration duration: Int) -> Transition

Create a new transition targeting to over duration milliseconds.

pub fn on_complete(t: Transition, tag: String) -> Transition

Set the completion event tag. Fires a transition_complete widget event when the animation finishes.

pub fn repeat(t: Transition, repeat: Repeat) -> Transition

Set the repeat behavior.

Search Document