An entrance that scales elements up into place on load or when they scroll into view.
Installation
Usage
<script setup lang="ts">
import { Zoom, Zooms } from '@animate-ui/vue/primitives/effects/zoom';
import Card from './Card.vue';
</script>
<template>
<Zoom>
<h1>Animated primitives for Vue</h1>
</Zoom>
<!-- Staggered: each child starts 100ms after the previous one. -->
<Zooms :hold-delay="100">
<Card />
<Card />
<Card />
</Zooms>
</template>With as-child, the animation is applied to your element instead of a wrapping div.
Animation
- The element scales from
initial-scale(0.5 by default) toscaleon a spring (stiffness 200, damping 20), overshooting by about 2% before it settles. - Under reduced motion, it doesn't scale: it fades in instead.
in-viewwaits for the element to scroll into view, once by default.<AnimateUIProvider :tempo>paces the default spring.
API Reference
Zoom
| Prop | Type | Default |
|---|---|---|
as-child? | boolean | false |
initial-scale? | number | 0.5 |
scale? | number | 1 |
delay? | number | 0 |
transition? | Transition | { type: 'spring', stiffness: 200, damping: 20 } |
in-view? | boolean | false |
in-view-once? | boolean | true |
in-view-margin? | string | '0px' |
...props? | HTMLMotionProps<'div'> | - |
Zooms
Wraps each child in a Zoom, delaying each one a little more than the previous.
| Prop | Type | Default |
|---|---|---|
#default | slot | - |
hold-delay? | number | 0 |
...props? | ZoomProps | - |