Core Module

Animatable

The Animatable API creates a persistent, reactive binding between an element and its animatable properties — great for interaction-driven animations.

createAnimatable()

Returns an object with setters for each declared property. Updating a setter instantly animates the element to the new value.

import { createAnimatable } from 'animejs';

const box = createAnimatable('.box', {
  x: { duration: 600, ease: 'outElastic' },
  y: { duration: 600, ease: 'outElastic' },
  scale: { duration: 300 },
});

// Animate on mouse move
document.addEventListener('mousemove', (e) => {
  box.x = e.clientX;
  box.y = e.clientY;
});

Use Cases

Per-Property Options

PropertyDefaultDescription
duration500Transition duration in ms
ease'outQuad'Easing function for transitions
delay0Delay before the transition starts
composition'replace'How values compose ('replace' or 'blend')