AOS

~5kb gzipped

Declarative reveal-on-scroll animations via HTML data attributes.


01

See It in Action

Each demo scrolls naturally in the iframe. Decorate elements with data-aos attributes, call AOS.init() once -- scroll up and down to see them replay.

Six cards fade up in staggered sequence as you scroll past the hero. data-aos-delay adds the per-card offset -- zero custom JS.

Preview

02

What is AOS?

Maintenance note: AOS is stable and feature-complete. The last commit landed in March 2024 and the author stopped active development. It still works reliably on modern browsers and powers thousands of live sites, but if you need ongoing updates or a more powerful scroll-animation engine, reach for GSAP ScrollTrigger instead.

AOS (Animate On Scroll) is a tiny library that reveals elements with prebuilt animations as they enter the viewport. You add data-aos="fade-up" to any element, call AOS.init() once, and the library handles the rest -- watching scroll position via IntersectionObserver and toggling CSS classes that drive the effect.

The appeal is speed to result. 20+ effects, per-element duration / delay / offset / easing via data attributes, and no JS per element. For small marketing pages and content-heavy sites, it remains one of the fastest ways to ship scroll reveal animations.

🏷️
Data-Attribute API
Add data-aos="fade-up" to any element and it animates into view on scroll. No JS wiring per element -- the declarative approach that made AOS popular.
🎨
20+ Prebuilt Effects
fade, zoom, flip, slide-up/down/left/right and more. Each takes direction and variation (e.g., fade-up-right) so you rarely need to touch CSS.
⚙️
Per-Element Control
data-aos-duration, data-aos-delay, data-aos-offset, data-aos-easing, data-aos-once -- tune any element without a global config change.

03

When to Use AOS

Use when
Landing page section reveals as the user scrolls down
Team, feature, or pricing grids fading in with stagger
Alternating image-text rows with directional slides
Testimonial blocks, FAQ accordions, or step-by-step sections
Any marketing page that wants a 'designed' reveal without custom JS
Avoid when
Projects needing active maintenance guarantees -- AOS has no commits since March 2024
Complex choreographed sequences or timeline control -- use GSAP ScrollTrigger
Accessibility-strict contexts -- AOS does not respect prefers-reduced-motion by default

04

How AOS Compares

AOS vs GSAP ScrollTrigger

GSAP ScrollTrigger is the actively-maintained, professional-grade choice. AOS is simpler and declarative but dormant. If you need ongoing updates, fine-grained control, or scrubbing animations tied to scroll position, use ScrollTrigger.

AOS wins at
Zero JS per element, beginner-friendly HTML API, tiny (~5kb), 20+ effects out of the box, perfect for simple landing pages
GSAP ScrollTrigger wins at
Active development, timeline sequencing, scroll-scrubbing, pin / toggle / snap behaviors, paired with GSAP's full animation engine
AOS vs Lenis

Lenis and AOS solve different problems -- they complement each other. Lenis smooths the scroll itself; AOS triggers animations when elements enter the viewport. You can use both together on the same page.

AOS wins at
Reveals elements as they enter view, data-attribute API, 20+ prebuilt effects ready to go
Lenis wins at
Smooths the scroll experience itself, programmatic scrollTo, no reveal behavior included
AOS vs Native CSS animations + IntersectionObserver

You can roll your own with ~20 lines of JS and CSS -- add a class when an element enters the viewport, animate that class with @keyframes. AOS is essentially a pre-made version of this pattern with 20 effects and config API.

AOS wins at
Zero custom code, consistent effect library across a whole site, per-element attributes instead of class toggles, delay and stagger built in
Native CSS animations + IntersectionObserver wins at
Zero dependencies, smallest possible bundle, full control over animation curves, no abandoned-library risk

05

Get Started with AOS

Terminal
npm install aos
Terminal
yarn add aos
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/aos.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/aos.js"></script>
Quick Start
<!-- In your <head> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/aos.css">

<!-- Near the end of <body> -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/aos.js"></script>
<script>
  // One call at page load -- AOS watches scroll and toggles classes
  AOS.init({
    duration: 700,      // ms
    offset: 80,         // fire 80px before element enters viewport
    easing: "ease-out-cubic",
    once: true          // set false to replay when scrolling back
  });
</script>

<!-- Then decorate any element: -->
<div data-aos="fade-up">I fade in as I scroll into view</div>
<div data-aos="fade-up" data-aos-delay="100">Me too -- 100ms later (stagger)</div>
<div data-aos="zoom-in-right" data-aos-duration="1000">Zoom in from the right, slowly</div>

06

Related Libraries