Components / ScrollLinked

ScrollLinked

Fades, moves or scales its content by how far the page has scrolled.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn scroll_linked() -> impl View {
    let card = |text: &'static str| {
        ScrollLinked::new(Card::new(Text::new(text)), ScrollLink::fade_in().range(ScrollRange::Enter))
    };
    ScrollView::new((
        card("Each card fades in"),
        card("and rises into place"),
        card("as it enters the view,"),
        card("following the scroll"),
        card("and not a clock."),
    ))
    .spacing(80.0)
    .height(220.0)
}

Open in the playground, with every example →

Full API of ScrollLinked →