Vue 3 scroll animation

Vue gets first-class treatment here rather than a vanilla escape hatch: a <ScrollDraw> component for the common case, and a useScrollDraw composable when you need the instance to pause, seek or replay it. Both ship in the same package — there is no separate Vue build to install, and both clean up on unmount so nothing leaks across route changes.

10Vue · ScrollDraw component

The code

A sailing school's home page. The hero's line-drawn sloop — hull, mast, sails, then the swell — fades and draws as it scrolls in, written here as you would in Vue with the ScrollDraw component.

Hero.tsx20 lines
<script setup>
import { ScrollDraw } from 'svg-scroll-draw/vue';
</script>

<template>
  <ScrollDraw
    class="boat"
    :trigger="{ start: 'top 90%', end: 'top 20%' }"
    :stagger="0.07"
    easing="ease-out"
    fade
    once
  >
    <svg viewBox="0 0 420 340">
      <path class="hull" d="…" />
      <path class="sail" d="…" />
      <path class="sea"  d="…" />
    </svg>
  </ScrollDraw>
</template>
Tidewater, a sailing school in falmouth: the first screen of its demo site

A sailing school in Falmouth

Tidewater

Live site

Related examples

MIT licensed, zero runtime dependencies. Every API is a separate entry point, so you only ship what you import. Full API reference →