Foundations
Motion
Animate content as it enters the screen with BaseReveal and the Motion V presets.
composables/useMotionPresets.ts
Animations use Motion V. The template wraps it in one component and a set of presets so every animation shares the same spring.
BaseReveal
Wrap a block to animate it the first time it scrolls into view:
<BaseReveal animation="slide-y" :distance="24" :delay="0.1">
<BaseCard title="Revenue" />
</BaseReveal>
Prop | Type | Default | Description |
|---|---|---|---|
animation | fade | zoom | slide-x | slide-y | fade | The entrance effect. |
distance | number | 24 | Pixels travelled by the slide animations. |
delay | number | 0 | Seconds to wait before starting. |
trigger | in-view | mount | in-view | Start when the block enters the viewport or as soon as it mounts. |
tag | string | div | The element to render. |
BaseReveal animates only once per visit. Do not add ref + useInView by hand.
Rules of thumb
- One reveal per block, not per item. Animating each card of a grid separately feels slow.
- Never hide the hero. The
h1, the lead and the call to action must be in the server HTML and visible immediately; animate only decoration around them. - Respect the user.
MotionConfig reduced-motion="user"inapp.vueturns animations off when the operating system asks for reduced motion.
Presets
useMotionPresets() returns objects you can spread on any motion component:
<script setup lang="ts">
import { motion } from 'motion-v'
const { zoomIn } = useMotionPresets()
</script>
<template>
<motion.div v-bind="zoomIn({ delay: 0.2 })">…</motion.div>
</template>
Preset | Effect |
|---|---|
fadeIn(options) | Opacity from 0 to 1. |
zoomIn(options) | Fades in from 92% scale. |
slideInY(y, options) | Fades in while moving y pixels vertically. |
slideInX(x, options) | Fades in while moving x pixels horizontally. |
springTransition | The shared spring: 0.4 s, low bounce. |
options accepts delay and animate (set it to false to keep the initial state, for example while data loads).