Module: Plushie::Animation

Defined in:
lib/plushie/animation.rb,
lib/plushie/animation/tween.rb,
lib/plushie/animation/spring.rb,
lib/plushie/animation/sequence.rb,
lib/plushie/animation/transition.rb,
sig/plushie/animation.rbs

Overview

Animation system.

Renderer-side descriptors (preferred)

Transition, Spring, and Sequence are pure data descriptors that tell the renderer how to animate a prop. The renderer interpolates locally with zero wire traffic during animation. Use these for visual property animations (opacity, position, size, color).

container("card",
opacity: Animation::Transition.build(300, to: 1.0, from: 0.0),
scale: Animation::Spring.build(to: 1.0, preset: :bouncy))

SDK-side tween (when needed)

Animation::Tween is a manual interpolator for cases where you need host-side control over the animated value. Requires subscribing to animation frames and advancing the tween each tick.

Defined Under Namespace

Classes: Sequence, Spring, Transition, Tween

Constant Summary collapse

SPRING_PRESETS =

Named spring presets.

Returns:

  • (Hash[Symbol, Hash[Symbol, Numeric]])
{
  gentle: {stiffness: 120, damping: 14},
  bouncy: {stiffness: 300, damping: 10},
  stiff: {stiffness: 400, damping: 30},
  snappy: {stiffness: 200, damping: 20},
  molasses: {stiffness: 60, damping: 12}
}.freeze