Skip to content

module

spec

Declarative motion: the motion* template attributes, presets, and text splitting.

h1(motion: "fade-up") "Hello"
ul(motion: "pop", motion-stagger: 0.06) { li "a" li "b" li "c" }
div(motion-from: "opacity: 0; x: -60", motion-duration: 1.2, motion-ease: "expo.out",
    motion-trigger: "scroll", motion-start: "top 80%")
img(motion: "float")                       // loops forever
section(motion-to: "rotation: 360", motion-trigger: "scroll", motion-scrub: true)

Structs

Enums

  • SplitBy

    How to split text for per-character or per-word animation.

  • Trigger

    When a declarative animation runs.

Functions

parse_props

pub fn parse_props(s: &str) -> Vec<(String, String)>

"opacity: 0; y: 40px, rotation: -10" → [("opacity","0"), …]. Pairs are separated by ; (or by , outside parentheses).

preset_names

pub fn preset_names() -> Vec<&'static str>

Names of the built-in presets.

split_text

pub fn split_text(text: &str, by: SplitBy) -> Vec<(String, bool)>

Split text into animatable pieces; whitespace is kept as its own pieces (marked false) so spacing survives inline-block layout.