explaingit

michalsnik/aos

28,070JavaScriptAudience · vibe coderComplexity · 2/5DormantLicenseSetup · easy

TLDR

A lightweight JavaScript library that triggers animations on HTML elements as users scroll down the page, with customizable fade, flip, zoom, and slide effects.

Mindmap

mindmap
  root((AOS))
    What it does
      Scroll-triggered animations
      Fade, flip, zoom, slide
      Repeatable or one-time
    How to use
      Add data-aos attribute
      Call AOS.init()
      Configure timing and delay
    Tech stack
      JavaScript
      CSS transitions
      npm package
    Use cases
      Marketing sites
      Landing pages
      Portfolio websites
    Customization
      Global defaults
      Per-element settings
      Animation timing

Things people build with this

USE CASE 1

Build a marketing website where product features fade in as visitors scroll down the page.

USE CASE 2

Create a portfolio site where project cards flip or zoom into view when scrolled into the viewport.

USE CASE 3

Add polish to a landing page with staggered slide-up animations on text and images.

USE CASE 4

Design a one-page site where each section animates in with custom timing and delay as users scroll.

Tech stack

JavaScriptCSSnpm

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

AOS, short for "Animate on Scroll," is a small JavaScript library for adding animations to elements on a web page as the visitor scrolls. The idea is simple: as you scroll down, elements fade in, slide up, flip, zoom, or otherwise animate into view; and if you scroll back to the top, they animate back to their previous state and are ready to play again the next time you scroll past them. The author describes the effect as similar to WOWJS, but built around a different idea: the animations are driven by CSS3 rather than by JavaScript moving things frame by frame. In practice, you install AOS through npm or bower, link its CSS file, include its JavaScript file, and then call AOS.init() once on your page. To animate any element you add a data-aos attribute to the HTML, for example data-aos="fade-up" or data-aos="flip-left", and that element will animate using the chosen built-in animation when it scrolls into view. Extra data attributes let you tune individual elements: data-aos-offset to trigger sooner or later, data-aos-duration for how long the animation lasts, data-aos-easing to change the timing curve, data-aos-delay to pause before starting, data-aos-anchor to tie the trigger point to a different element, data-aos-anchor-placement to control which part of the element must hit which part of the viewport, and data-aos-once to play only the first time. You can also pass an options object to AOS.init() to set defaults for the whole page, and a disable option lets you turn AOS off on mobile or under any custom condition. The library exposes init, refresh, and refreshHard methods, the last two used to recalculate positions when the page changes. It is built as a UMD module so it can be loaded as AMD, a global script, a Node module, or an ES6 import. You would use AOS when you want polished scroll animations on a landing page or marketing site without writing the animation logic yourself.

Copy-paste prompts

Prompt 1
Show me how to add fade-up animations to all my section headings using AOS, with a 200ms delay between each one.
Prompt 2
I want to use AOS on my landing page. Walk me through installing it via npm and setting up a basic scroll animation on my hero image.
Prompt 3
How do I configure AOS so animations only play once when scrolled into view, and trigger when the element is 80% visible?
Prompt 4
Give me an example of using AOS with different animation types (fade, flip, zoom) on different elements, with custom timing for each.
Prompt 5
I'm building a portfolio site. Show me how to set global AOS defaults in init() so I don't repeat settings on every element.
Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.