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:

vue
<BaseReveal animation="slide-y" :distance="24" :delay="0.1">
  <BaseCard title="Revenue" />
</BaseReveal>
Prop
Type
Default
Description
animationfade | zoom | slide-x | slide-yfadeThe entrance effect.
distancenumber24Pixels travelled by the slide animations.
delaynumber0Seconds to wait before starting.
triggerin-view | mountin-viewStart when the block enters the viewport or as soon as it mounts.
tagstringdivThe 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" in app.vue turns animations off when the operating system asks for reduced motion.

Presets

useMotionPresets() returns objects you can spread on any motion component:

vue
<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.
springTransitionThe 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).

© 2026 melsami UI.
Developer documentation for melsami UI.