Skip to content

Migrate from AOS

MOS is API-compatible with AOS where practical. In many cases you only need to swap the script and CSS imports, and rename attributes.

Terminal window
npm uninstall aos
npm install motion-on-scroll
<link rel="stylesheet" href="bower_components/aos/dist/aos.css" />
<script type="module">
import AOS from 'aos';
AOS.init({
duration: 600,
once: true
});
</script>
AOS MOS Notes
data-aos data-mos Animation preset name
data-aos-offset data-mos-offset Positive number in px
data-aos-delay data-mos-delay ms
data-aos-duration data-mos-duration ms
data-aos-easing data-mos-easing Easing keyword or cubic-bezier()
data-aos-anchor data-mos-anchor New trigger for animation
data-aos-anchor-placement data-mos-anchor-placement 9 keyword combos
data-aos-once data-mos-once Boolean
data-aos-mirror data-mos-mirror Boolean
data-aos-id data-mos-id Used for mos:in:<id> / mos:out:<id> events
AOS option MOS option Default
offset offset 120
duration duration 400
delay delay 0
easing easing 'ease'
once once false
disable disable false
mirror mirror false
throttleDelay throttleDelay 99
debounceDelay debounceDelay 50
startEvent startEvent 'DOMContentLoaded'
disableMutationObserver disableMutationObserver false
anchorPlacement anchorPlacement 'top-bottom'
initClassName initClassName 'mos-init' (AOS: 'aos-init')
animatedClassName animatedClassName 'mos-animate' (AOS: 'aos-animate')
useClassNames useClassNames false

The aos:in / aos:out events become mos:in / mos:out.

MOS ships all of the AOS presets. Any custom animations can be replicated by registering custom presets.

You’re done! Your site now enjoys GPU-accelerated, browser-native scroll animations—Motion uses the Web Animations API when possible, and gracefully falls back to JavaScript (requestAnimationFrame) for values WAAPI can’t handle.