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>
AOSMOSNotes
data-aosdata-mosAnimation preset name
data-aos-offsetdata-mos-offsetPositive number in px
data-aos-delaydata-mos-delayms
data-aos-durationdata-mos-durationms
data-aos-easingdata-mos-easingAny CSS easing or spring()
data-aos-anchordata-mos-anchorNew trigger for animation
data-aos-anchor-placementdata-mos-anchor-placement9 keyword combos
data-aos-oncedata-mos-onceBoolean
AOS optionMOS optionDefault
offsetoffset120
durationduration400
delaydelay0
easingeasing'ease'
onceoncefalse
disabledisablefalse
mirrormirrorfalse
throttleDelaythrottleDelay99
debounceDelaydebounceDelay50
startEventstartEvent'DOMContentLoaded'
disableMutationObserverdisableMutationObserverfalse

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.