@juleshry/vue-animejs

SSR-safe Vue 3 composables and directives for Anime.js v4 — reactive animations that integrate naturally with Vue's reactivity system and component lifecycle.
2,567 6
Install
npm install @juleshry/vue-animejs
Latest Version:1.5.0
Vue:3
License:MIT
Last Updated:Oct 19, 2026
Links: GitHub  ·  npm
Maintainer: juleshry

🚀 Overview

vue-animejs wraps Anime.js v4 as idiomatic Vue 3 composables. It integrates with Vue's reactivity system — pass a ref as a target, as the options, or straight inside the options object ({ translateX: distance }), and the animation updates automatically. Lifecycle cleanup is handled for you.

SSR-safe: every composable and directive works with server-side rendering (Nuxt, @vue/server-renderer) with no <ClientOnly> wrapper. Nothing touches window or document on the server, and Anime.js instances are only created in the browser. Directives go further and render their initial state on the server (v-animate, v-waapi, v-svg-drawable, and v-text-split with ssrHidden), so elements don't flash their final state before hydration.

Before — raw Anime.js in a Vue component:

<script setup lang="ts">
import { useTemplateRef, onMounted, onUnmounted } from 'vue'
import { animate } from 'animejs'

const el = useTemplateRef<HTMLElement>('el')
let animation

onMounted(() => {
  if (!el.value) {
    console.warn('Targets element is null or undefined')
    return
  }
  
  animation = animate(el.value, { translateX: 250, duration: 800 })
})

onUnmounted(() => {
  animation?.cancel()
})
</script>

<template>
  <div ref="el" />
</template>

After — with vue-animejs:

<script setup lang="ts">
import { useTemplateRef } from 'vue'
import { useAnimate } from '@juleshry/vue-animejs'

const el = useTemplateRef<HTMLElement>('el')

useAnimate(el, { translateX: 250, duration: 800 })
</script>

<template>
  <div ref="el" />
</template>

📦 Requirements

  • Vue 3.5+
  • Anime.js 4+
  • @vueuse/core 14+

🦄 Composables & Directives

Composable Description
useAnimate Animate a DOM target with reactive params
useRawAnimate Thin wrapper around Anime.js animate() with ref unwrapping
useTimer Drive a timer with full playback control
useTimeline Sequence multiple animations on a shared timeline
useScroll Drive an animation's autoplay option from scroll position
useWaapi Animate via the Web Animations API (WAAPI)
useAnimatable Create a reactive animatable object
useDraggable Make a DOM element draggable with full control
useLayout Animate DOM layout changes (reorder, add, remove)
useScope Create an Anime.js scope with lifecycle management
useSvg SVG utilities: morph paths and motion path
useSvgDrawable Animate SVG stroke drawing with the draw property
useText Split text into animatable lines, words, and chars

Directives — declarative alternatives for element-bound animations:

Directive Description
v-animate Animate an element declaratively via template attribute
v-draggable Make an element draggable declaratively
v-svg-drawable Animate SVG stroke drawing declaratively via the draw property
v-waapi Animate via WAAPI declaratively
v-text-split Split text into animatable lines, words, and chars declaratively

🚀 Usage

For full API docs and live demos, see the doc here.

👨‍🚀 Contributors

🌸 Thanks

🧱 Contributing

See the Contributing Guide.

🗺️ TODO

  • Add components

📄 License

MIT © 2025-present Jules Hery

Related Packages

nanime

Anime.js v4 for Nuxt: SSR-safe, auto-imported composables and transitions for an...

6,700 14
@njdamstra/v-animate

Vue 3 animation composable with plugin-based architecture

1,994 0
vue-animejs

A simple Vue plugin for binding Anime.js

58,810 173
vue-worker-kit

Type-safe Web Worker composables for Vue 3 — useWorker(), worker pool, reactive...

1,903 0
@quantajs/vue

Vue bindings for QuantaJS stores.

347 11

Version History

Version Released License
1.5.0 MIT
1.4.1 MIT
1.4.0 MIT
1.3.0 MIT
1.2.2 MIT
Pre-releases (5)
Version Released License
1.5.0-beta.1 MIT
1.5.0-beta.0 MIT
1.4.1-beta.0 MIT
1.4.0-beta.1 MIT
1.4.0-beta.0 MIT