The Animation class provides a Promise-based wrapper for performing animations.
nodeis a HTMLElementcallbackis a function that acceptsnode,progressandoptionsas arguments, wherenodeis a HTMLElement,progressis a value between 0 and 1 andoptionsis theoptionsobject passed to this method.optionsis an object containing options for how the animation should be handled.durationis the number of milliseconds that the animation should last, and will default to 1000.typeis a string of either ease-in, ease-out, ease-in-out or linear indicating the type of animation to run, and will default to ease-in-out.infiniteis a boolean indicating whether the animation should continue forever, and will default to false.
const animation = new $.Animation(node, callback, options);The Animation object resolves when the animation is completed, or rejects if it is stopped without finishing.
It is also possible to stop a running Animation.
optionsis an object containing options for how the animation should be stopped.finishis a boolean indicating whether to immediately finish the animation, and will default to true.
animation.stop(options);The AnimationSet class provides a Promise-based wrapper for performing a set of animations.
animationsis an array of Animation objects.
const animationSet = new $.AnimationSet(animations);The AnimationSet object resolves when the animations are completed, or rejects if it is stopped without finishing.
It is also possible to stop a running AnimationSet.
optionsis an object containing options for how the animations should be stopped.finishis a boolean indicating whether to immediately finish the animation, and will default to true.
animationSet.stop(options);