Skip to content

JavaScript scroll animations

Use @awesome-reveal/core to add scroll animations to a page with no framework. An element fades and slides in when it scrolls into view. The package does not link an animation to the scroll position, as a parallax effect or a scroll progress bar does.

Terminal window
pnpm add @awesome-reveal/core

For the supported browsers, see Browser support.

Call reveal() with a CSS selector, an element or a list of elements:

import { reveal } from "@awesome-reveal/core";
reveal(".card");
reveal(".hero", { from: "left" });
reveal(".logo", { from: { opacity: 0, scale: 0.9 } });

from sets the entrance. To fade, zoom, rotate or blur the element in, set a start state.

For elements that you add later, see Targets.

cascade() reveals the direct children of each container one after the other:

import { cascade } from "@awesome-reveal/core";
cascade(".features", { from: { opacity: 0, y: 16 }, interval: 120 });

For a long list or a tall grid, see Animate a list.

reveal() and cascade() return a handle. When you remove the elements before they reveal, call dispose():

import { reveal } from "@awesome-reveal/core";
const handle = reveal(".card");
// When a single-page app leaves the route:
handle.dispose();

@awesome-reveal/core does not hide content before your script runs. See The JavaScript API. For server-rendered pages, use React, Vue or Astro.