pub struct ScrollLink { /* private fields */ }Expand description
Turns scroll progress into an Effect: opacity, movement and scale.
Pick a ScrollRange, narrow it to a window with Self::between, shape it with
an Easing, and describe the effect with keyframes or any function. Presets cover
the usual entrances and exits.
Implementations§
Source§impl ScrollLink
impl ScrollLink
Sourcepub fn custom(map: impl Fn(f32) -> Effect + 'static) -> Self
pub fn custom(map: impl Fn(f32) -> Effect + 'static) -> Self
The effect is map(t), where t runs from 0 to 1 over the window, after easing.
Sourcepub fn keyframes(stops: impl IntoIterator<Item = (f32, Effect)>) -> Self
pub fn keyframes(stops: impl IntoIterator<Item = (f32, Effect)>) -> Self
Interpolates between effects at given points of the window, like CSS keyframes. Before the first stop the first effect holds, after the last the last one does. No stops is no effect.
Sourcepub fn parallax(distance: f32) -> Self
pub fn parallax(distance: f32) -> Self
Moves distance pixels down over the window: a negative distance moves it up.
Slower than the scroll, it reads as depth.
Sourcepub fn range(self, range: ScrollRange) -> Self
pub fn range(self, range: ScrollRange) -> Self
Measures this range instead of the default ScrollRange::Scene.
Sourcepub fn between(self, from: f32, to: f32) -> Self
pub fn between(self, from: f32, to: f32) -> Self
Plays the whole effect inside this part of the range, 0.0..=1.0: before from
it shows its start, after to its end. Scenes use it to give each step its turn.
Sourcepub fn easing(self, easing: Easing) -> Self
pub fn easing(self, easing: Easing) -> Self
Shapes the progress inside the window (linear by default).
Sourcepub fn scroll_range(&self) -> ScrollRange
pub fn scroll_range(&self) -> ScrollRange
The range this link measures.
Trait Implementations§
Source§impl Clone for ScrollLink
impl Clone for ScrollLink
Source§fn clone(&self) -> ScrollLink
fn clone(&self) -> ScrollLink
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more