New
v4.2.0
Breaking Changes
- Utils
- Remove
interpolate()(use the simplifiedlerp()instead) - Remove the clock parameter from
lerp()(use the framerate dependent damping functiondamp()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 nativeelement.style.setProperty('--value')
- Remove
- Easings
linear(),irregular(),steps()andcubicBezier()have been removed from the core and must be imported separately
New Features
- API
- All modules can now be imported individually with subpaths:
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
bounceparameter to control the strength of the spring - Add
durationparameter to define the perceived duration of the spring - Add
onCompletecallback 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)
- Add
- WAAPI
waapi.animate()built-in eases are now on par with the JSanimate()method, plus all native WAAPI easing parameters- Add
persistparameter 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)' }))
- Add support for CSS variable values (e.g.,
- Utils
- Add
createSeededRandom()to generate pre-seeded pseudo-random utility functions
- Add
- Docs
- Add an easing functions 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
- Fix
- 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: truenot updating on play
- Fix
- Timeline
- Fix
tl.call()not being fired in some cases (#1088)
- Fix
Changes
- Utils
stagger()has been moved to/utilsbut still available globally viaimport { stagger } from 'animejs'
- WAAPI
waapi.convertEase()values are now rounded to 4 decimals (previously no rounding)
- Spring
massminimum value is now clamped to 1stiffnessminimum allowed value is now 0dampingminimum allowed value is now 0
- Easings
Ease Backdefault overshoot value is now 1.7 (previously 1.70158)
- Types
- Add
@types/nodedependency for type checking (#1069)
- Add
- Build
- Simplify build scripts:
build,dev,dev:test,test:browser,test:node,open:examples
- Simplify build scripts:
Deprecated
- Text
text.split()deprecated, usesplitText()ortext.splitText()instead
- Spring
createSpring()deprecated, usespring()instead