struct
ScrollTrigger
pub struct ScrollTrigger {
pub start: Edge,
pub end: Edge,
pub scrub: Option<f64>,
pub actions: [Action; 4],
pub once: bool,
}When a scroll-triggered animation plays: where it starts and ends in the viewport, whether it's scrubbed, and what each crossing does.
Fields
scrub
pub scrub: Option<f64>Some(0) ties progress to the scroll directly; Some(s) smooths it over s seconds; None plays on enter instead.
Methods
toggle_actions
pub fn toggle_actions(self, s: &str) -> Option<ScrollTrigger>The trigger with its four crossing actions set from s ("play none none reverse": enter, leave, enter back, leave back), if each is an action.
progress
pub fn progress(&self, top: f64, height: f64, viewport: f64) -> f64Progress through the start→end range (unclamped), from the trigger's viewport-relative top and height and the viewport height.
crossing
pub fn crossing(previous: f64, now: f64) -> Option<Crossing>The crossing between two progress readings, if any.