Capítulo 118 de 142
Manage motion value event listeners in Vue with useMotionValueEvent. Auto-cleans events like change & animationComplete for dynamic UIs.
<script setup>
import { useMotionValue, useMotionValueEvent } from "motion-v"
const x = useMotionValue(0)
useMotionValueEvent(x, "animationStart", () => {
console.log("animation started on x")
})
useMotionValueEvent(x, "change", (latest) => {
console.log("x changed to", latest)
})
</script>
<template>
<motion.div :style="{ x }" />
</template>
change.animationStart.animationComplete.animationCancel.