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) -> ScrollLink
pub fn custom(map: impl Fn(f32) -> Effect + 'static) -> ScrollLink
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)>) -> ScrollLink
pub fn keyframes(stops: impl IntoIterator<Item = (f32, Effect)>) -> ScrollLink
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 fade_in() -> ScrollLink
pub fn fade_in() -> ScrollLink
Fades in and rises 24 pixels into place.
Sourcepub fn fade_out() -> ScrollLink
pub fn fade_out() -> ScrollLink
Fades out and lifts 24 pixels away.
Sourcepub fn parallax(distance: f32) -> ScrollLink
pub fn parallax(distance: f32) -> ScrollLink
Moves distance pixels down over the window: a negative distance moves it up.
Slower than the scroll, it reads as depth.
Sourcepub fn grow_from(from: f32) -> ScrollLink
pub fn grow_from(from: f32) -> ScrollLink
Grows from from to full size.
Sourcepub fn range(self, range: ScrollRange) -> ScrollLink
pub fn range(self, range: ScrollRange) -> ScrollLink
Measures this range instead of the default ScrollRange::Scene.
Sourcepub fn between(self, from: f32, to: f32) -> ScrollLink
pub fn between(self, from: f32, to: f32) -> ScrollLink
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) -> ScrollLink
pub fn easing(self, easing: Easing) -> ScrollLink
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