v4.2.0

juliangarnier/animev4.2.0Sep 29, 2025by juliangarnier

AI Summary

Major modularization effort allowing individual imports, spring enhancements, WAAPI parity, and removal of legacy utilities.

Key Highlights

  • Individual module imports (subpaths)
  • Spring enhancements (bounce, duration, over-damped support)
  • WAAPI parity with JS engine
  • Removal of legacy `interpolate()` and core easings

Breaking Changes

  • Remove `interpolate()` utility (use `lerp`)
  • Remove clock parameter from `lerp()`
  • CSS variable setting now computes values instead of setting names
  • Remove core easings (`linear`, `irregular`, etc.)
  • Deprecate `text.split()` and `createSpring()`

New Features

  • CSS variable support in animations
  • Seeded random utility
  • Easing editor documentation
  • Improved draggable Shadow DOM support

Full Release Notes

## Breaking Changes
- **Utils**
  - Remove `interpolate()` (use the simplified `lerp()` instead)
  - Remove the clock parameter from `lerp()` (use the framerate dependent damping function `damp()` instead)
  - Setting a CSS variable using `utils.set()` now computes the variable value instead of setting the var name. To set the variable name without conversion, use a function-based value (`x: () => var(--value)`) or use the native `element.style.setProperty('--value')`
- **Easings**
  - `linear()`, `irregular()`, `steps()` and `cubicBezier()` have been removed from the core and must be imported separately

## New Features
- **API**
  - All modules can now be imported individually with subpaths:
```js
import { animate } from 'animejs/animation';
import { createTimer } from 'animejs/timer';
import { createTimeline } from 'animejs/timeline';
import { createAnimatable } from 'animejs/animatable';
import { createDraggable } from 'animejs/draggable';
import { createScope } from 'animejs/scope';
import { engine } from 'animejs/engine';
import * as events from 'animejs/events';
import * as easings from 'animejs/easings';
import * as utils from 'animejs/utils';
import * as svg from 'animejs/svg';
import * as text from 'animejs/text';
import * as waapi from 'animejs/waapi';
```
- **Spring**
  - Add `bounce` parameter to control the strength of the spring
  - Add `duration` parameter to define the perceived duration of the spring
  - Add `onComplete` callback called when the spring currentTime hits the perceived duration
  - Support for over-damped springs with stiffness values below 30 (previously these values had no effect)
- **WAAPI** 
  - `waapi.animate()` built-in eases are now on par with the JS `animate()` method, plus all native WAAPI easing parameters
  - Add `persist` parameter to control whether the animation should be canceled on finish
- **JS Animation**
  - Add support for CSS variable values (e.g., `animate(target, { x: 'var(--x, 100px)' })`)
- **Utils**
  - Add `createSeededRandom()` to generate pre-seeded pseudo-random utility functions
- **Docs**
  - Add an [easing functions editor](https://animejs.com/easing-editor)

## Bug Fixes
- **Draggable**
  - Allow touch dragging within Shadow DOM (#1067)
  - Fix draggable getting stuck while dragging near the origin of the initial grab
- **Animation**
  - Fix `animation.revert()` not properly reverting multi-target animations styles when targets have different starting style values
  - Fix inline styles with hyphens (e.g., `border-radius`, `stroke-width`) not being properly reverted
- **WAAPI**
  - Fix `animation.cancel()` not properly committing styles before canceling
  - Fix `animation.revert()` not properly reverting multi-target animation styles and not overriding newly added styles
  - Fix scroll-controlled WAAPI animations being disconnected after completing once
  - Fix staggered animations with `reversed: true` not updating on play
- **Timeline**
  - Fix `tl.call()` not being fired in some cases (#1088)

## Changes
- **Utils**
  - `stagger()` has been moved to `/utils` but still available globally via `import { stagger } from 'animejs'`
- **WAAPI**
  - `waapi.convertEase()` values are now rounded to 4 decimals (previously no rounding)
- **Spring**
  - `mass` minimum value is now clamped to 1
  - `stiffness` minimum allowed value is now 0
  - `damping` minimum allowed value is now 0
- **Easings**
  - `Ease Back` default overshoot value is now 1.7 (previously 1.70158)
- **Types**
  - Add `@types/node` dependency for type checking (#1069)
- **Build**
  - Simplify build scripts: `build`, `dev`, `dev:test`, `test:browser`, `test:node`, `open:examples`

## Deprecated
- **Text**
  - `text.split()` deprecated, use `splitText()` or `text.splitText()` instead
- **Spring**
  - `createSpring()` deprecated, use `spring()` instead