Defines a named animation.
Here is the definition of the pre-defined fade-in animation:
up.animation('fade-in', function(element, options) {
element.style.opacity = 0
return up.animate(element, { opacity: 1 }, options)
})
For animations that can be expressed through CSS transitions,
we recommend that your definitions end by calling up.animate() with an object argument,
passing along your options and returning the result.
If you choose to not use up.animate() and roll your own
animation code instead, your code must honor the following contract:
{ duration, easing }, if given.up:motion:finish is emitted on
the given element, the animation instantly jumps to the last frame
and resolves the returned promise.Calling up.animate() with an object argument
will take care of all these points.
The name of the new animation.
The callback function that executes the animation.
Tip Your coding agent can search these docs locally with the Unpoly agent skill