animate() function or used when creating animation instances.
Core Parameters
targets
The element(s) to animate. This is the first argument to
animate() and accepts multiple formats:- CSS Selector:
'.my-element','#box','div' - DOM Element:
document.querySelector('.box') - NodeList:
document.querySelectorAll('.boxes') - Array:
[element1, element2, '.selector'] - JavaScript Object:
{ x: 0, y: 0 }
Timing Parameters
duration
Animation duration in milliseconds.
delay
Delay before animation starts in milliseconds.
loopDelay
Delay between loop iterations in milliseconds.
Playback Parameters
ease
Easing function for the animation. Can be a string name or custom function.Built-in Easings:
'linear','none''in','out','inOut''inQuad','outQuad','inOutQuad''inCubic','outCubic','inOutCubic''inQuart','outQuart','inOutQuart''inQuint','outQuint','inOutQuint''inSine','outSine','inOutSine''inExpo','outExpo','inOutExpo''inCirc','outCirc','inOutCirc''inBounce','outBounce','inOutBounce''inBack','outBack','inOutBack''inElastic','outElastic','inOutElastic'
playbackEase
Easing applied to the entire animation timeline playback.
playbackRate
Speed multiplier for animation playback. Values > 1 speed up, < 1 slow down.
frameRate
Maximum frame rate for the animation in frames per second.
Loop Parameters
loop
Number of times to loop the animation.
true or negative values create infinite loops.alternate
Whether to alternate direction on each loop iteration.
reversed
Whether to play the animation in reverse from the start.
Control Parameters
autoplay
Whether to automatically start the animation.
id
Custom identifier for the animation instance.
Property Composition
composition
How to compose with other animations on the same property.
'none': No composition, properties are independent'replace': New animations replace old ones on the same property'blend': New animations blend additively with existing ones
modifier
Function to modify animated values before they’re applied.
Property Values
Animation parameters can include any animatable properties. Property values support multiple formats:Number Values
String Values with Units
From-To Arrays
Multi-Value Arrays (Keyframes)
Object Values
Function Values
Relative Values
Keyframes
Duration-Based Keyframes
Array of keyframe objects, each with its own timing.
Percentage-Based Keyframes
Object with percentage keys defining keyframe positions.
Callbacks
onBegin
Called when the animation begins playing.
onUpdate
Called on every frame during the animation.
onComplete
Called when the animation completes.
onLoop
Called when the animation loops.
onPause
Called when the animation is paused.
onRender
Called when the animation renders to the DOM.
onBeforeUpdate
Called before each update tick.
Function Value Parameters
Many parameters accept functions that receive target information:Related
- animate() - Main animation function
- Animation Class - Animation instance methods