Vanilla-Scroll Demo | Fade In

Simple fade in example Back

Basic Slide Layout

View Fullscreen

Creates a foundation with two full-height slides, each occupying 100vh of vertical space for a clean, screen-filling presentation.

index.html

<section
    class="intro container"
    id="intro-container"
>
    <div class="content">
        <h1>Intro</h1>
    </div>
</section>
<section
    class="first container"
    id="first-container"
>
    <div class="content">
        <h2>First</h2>
    </div>
</section>

style.css

section
{
    .content
    {
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

script.js

import VanillaScroll from '@spomsoree/vanilla-scroll';

const scrolling = new VanillaScroll({ debug: true });

scrolling
    .build();

Title Reveal Animation

View Fullscreen

Implements a dynamic entrance effect by initially hiding the second title via CSS, then gradually revealing it with a fade-in animation as the user scrolls to just before the center point.

index.html

<section
    class="intro container"
    id="intro-container"
>
    <div class="content">
        <h1>Intro</h1>
    </div>
</section>
<section
    class="first container"
    id="first-container"
>
    <div class="content">
        <h2>First</h2>
    </div>
</section>

style.css

section
{
    .content
    {
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;

        h2
        {
            opacity: 0;
        }
    }
}

script.js

import VanillaScroll from '@spomsoree/vanilla-scroll';

const scrolling = new VanillaScroll({ debug: true });
const container = document.getElementById('first-container');
const headline = container.querySelector('h2');

scrolling
    .addTrigger({
        name: 'First',
        trigger: container,
        steps: [
            {
                name: 'Fade In',
                element: headline,
                offset: -10,
                duration: 7,
                changes: {
                    opacity: {
                        from: 0,
                        to: 1,
                    },
                },
            },
        ],
    })
    .build();