Skip to content

Installation

alrdy-animate ships GSAP and Lenis as external dependencies — they are never bundled. You add them via script tags (Webflow) or npm install (Next.js). The library detects window.gsap / window.Lenis at init and warns clearly in dev mode if anything required is missing.

GuideWhen to use it
WebflowA Webflow site with no page-transition library. Copy/paste blocks for site-wide and page-specific custom code.
Webflow + BarbaA Webflow site that uses Barba.js for page transitions. Wires init / destroy into Barba’s hooks.
Next.jsA Next.js project (App Router or Pages Router). Includes a client AlrdyInit component to mount in your root layout.

Every alrdy-animate project loads these in order, before the init() call:

ScriptWhen it’s neededNotes
gsapAlwaysThe animation engine.
ScrollTriggerMost pages (any scroll-driven animation, parallax, reveal, text, nav)Skip only if you use exclusively event-triggered animations.
CustomEaseAlways (recommended)Powers the named eases (osmo, energy, smooth, punch, relaxed, jump, pop, elastic, anticipate, bounce, fade).
SplitTextaa-split and any text animation (text-fade, text-blur, text-slide-*)
Flipaa-nav
Draggable + InertiaPluginaa-sliderBoth required together.
LenisSmooth scroll (on by default)Pass smoothScroll: false in init() to disable; or simply don’t include the script.

In dev mode (init({ debug: true })) the console logs the active feature set, the plugins it found, and whether Lenis is active. Any “Missing GSAP plugins” warning lists the exact <script> tags you still need to add.

The library exposes the following on window.AlrdyAnimate (UMD) and as named exports from 'alrdy-animate' (ESM):

APIPurpose
init(options)Scan the DOM (or a root subtree), apply from-states, wire ScrollTriggers and event listeners. Returns a Promise that resolves once feature modules have initialised.
destroy(options)Tear down. keepGlobals: true leaves Lenis / scroll-state observers alive across page swaps. keepFromStates: true skips clearProps so un-fired scroll animations stay hidden until the leaving DOM is removed.
refresh()Shorthand for destroy() then init() with the previous options.
onResize(fn, { debounce })Subscribe to a shared debounced resize bus. Returns an unsubscribe function.
ready()Returns a Promise that resolves after the most recent init() finishes mounting features and registering plugins/eases. Resolves immediately when called before any init, or after the previous init has already completed. Each new init() / refresh() creates a fresh promise.
optionsLive readonly snapshot of the resolved options after init() — every InitOptions field with defaults filled in, plus reducedMotion / optimizeMobile collapsed to the booleans the lib actually uses internally. Reads always reflect the most recent init.

init / destroy / refresh are the lifecycle hooks for Barba, View Transitions, or any other page-transition library — see the Webflow + Barba recipe for a full example. ready + options + onResize are the interop surface for project-specific GSAP scripts that load alongside the lib (custom navs, sliders, scroll-driven scenes) — see the Webflow guide for the recommended pattern.

For the full list of options accepted by init() (and their defaults — duration: 0.6, ease: 'power4.out', scrollStart: 'top 92%', again: true, smoothScroll: true, …) see Init options.

alrdy-animate ships an AGENTS.md reference inside the npm package so AI coding assistants (Claude Code, Cursor, Aider, Continue) can use the library accurately on the first try — no docs web-fetch required. The platform-specific guides include a copy-paste snippet for referencing it from your project’s own AI-instruction file (Next.js, Webflow).

Lenis is enabled by default. The library detects window.Lenis at init and wires it to GSAP’s ticker (gsap.ticker.add + gsap.ticker.lagSmoothing(0)) and to ScrollTrigger.update, so all scroll-driven animations follow the smoothed scroll position.

// Disable entirely
AlrdyAnimate.init({ smoothScroll: false })
// Or pass any Lenis option (https://github.com/darkroomengineering/lenis#instance-options)
AlrdyAnimate.init({
smoothScroll: {
lerp: 0.08,
wheelMultiplier: 1.2,
touchMultiplier: 2,
}
})

If you simply omit the Lenis <script> tag, smooth scroll is silently skipped (with a dev-mode warning if debug: true). The Lenis instance is exposed at window.lenis for custom scripts (window.lenis.scrollTo(...), .start(), .stop()).