Expand description
Time-driven animation primitives: easing, tweens, and frame cycles. Time-driven animation primitives for retained and immediate paints.
Everything here is a pure function of a caller-supplied clock — a
Duration since an arbitrary epoch — so animated
paints stay deterministic and testable. Retained components read the clock
from crate::PaintCtx::now and request a future repaint with
crate::PaintCtx::wake; immediate-mode painters call the same types
with their own elapsed time.
Three shapes cover terminal animation:
Frames: periodic glyph cycles (spinners, pulses) that run while a state holds and never finish.Tween: finite eased interpolations (color fades, progress smoothing) that settle, and can be retargeted mid-flight without a visual jump.Reveal: a paced cursor chasing a growing unit total (streamed text), catching up smoothly and settling once even.
Components get all of this declaratively: the anim, ease, and spin
properties tween fg/bg/bc colors, gradient endpoints, w/h
sizes, and gradient rotation on any component without custom paint code
— see crate::Props::anim, crate::Props::ease, and
crate::Props::spin. The shimmer property sweeps a
Shimmer brightness crest across <text>, the
reveal property paces streamed <text> content through a [Reveal]
cursor, and the hover and lift properties ride the same clock:
pointer-driven border chrome and elevation ease through their declared
anim/ease, and snap without one.
Structs§
- Frames
- A periodic glyph cycle on a caller-supplied clock.
- Reveal
- A paced cursor over streamed units — grapheme clusters, rows, blocks — that chases a growing total and settles once even with it.
- Shimmer
- A brightness crest sweeping across one line of cells.
- Tween
- A finite eased interpolation between two values on a caller-supplied clock.
Enums§
- Easing
- Easing curve applied to a tween’s normalized progress.
Constants§
- FRAME
- Repaint cadence for continuously changing values (mid-flight tweens,
gradient spins): fast enough to read as motion in a terminal, slow
enough to stay cheap. Pass
now + FRAMEtocrate::PaintCtx::wake.