Animatable class provides a powerful way to create reactive, animatable properties on DOM elements or JavaScript objects. Each property becomes both a getter and setter that can smoothly animate to new values.
Constructor
Target element(s) to make animatable. Can be:
- CSS selector string (e.g.,
'.element') - DOM element
- Array of elements
- JavaScript object
Configuration object defining animatable properties. Each key becomes an animatable property on the instance.
Parameters Object
Theparameters object defines which properties should be animatable and their configuration:
Define an animatable property. Can be:
number: Duration in milliseconds for default animationsobject: Configuration options for the property
Property Configuration Options
Default animation duration in milliseconds when property is updated.
Unit to append to the animated value (e.g.,
'px', '%', 'deg').Default easing function for animations.
Function to transform the animated value before applying it.
How this animation composes with other animations on the same property.
Animation Callbacks
Called when any property animation begins.
Called on each frame while any property is animating.
Called when all property animations complete.
Called when animations loop.
Called when animations are paused.
Properties
Array of target elements being animated.
Internal object containing the JSAnimation instances for each property.
Internal animation instance managing callbacks.
Dynamic Properties
Each property defined in theparameters object becomes a dynamic property on the Animatable instance: