Guides
Accessibility
Make nanime animations jump to their end state for visitors who ask for less motion.
Make nanime animations jump to their end state for visitors who turn on
reduced motion.
Follow the reduced motion setting
| Value | Reduces motion |
|---|---|
'never' | Never. This is the default. |
'system' | When the visitor's prefers-reduced-motion setting is reduce |
'always' | Always |
Set reducedMotion in nuxt.config.ts:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['nanime'],
nanime: {
reducedMotion: 'system',
},
})
When reduced motion is on, these jump to their end state instead of playing:
useAnimate,useWaapiAnimate,useAnimeTimeline,useAnimatableanduseScrambleText<AnimeTransition>and<AnimeTransitionGroup><AnimeLayoutGroup>anduseAnimeLayout
useDraggable and useAnimeScroll are not affected. They follow the
pointer and the scroll position, which the visitor controls.
Let visitors choose in your app
Call updateAppConfig() to change reducedMotion while the app runs, for
example from a settings toggle:
MotionSetting.vue
<script setup lang="ts">
function setReducedMotion(reduce: boolean) {
updateAppConfig({ nanime: { reducedMotion: reduce ? 'always' : 'system' } })
}
</script>
Components use the new setting on their next run. Composables read it when they create or rebuild an animation, so one that is already running is not changed.