Edit this page

API Animation
module up.motion

When you update a page fragment you can animate the change.

Transitions

When we morph between an old and a new element, we call it a transition.

For instance, you may add an [up-transition] attribute to your links or forms to smoothly fade out the old element while fading in the new element:

<a href="/?originalUrl=https%3A%2F%2Funpoly.com%2Fusers"
  up-target=".list"
  up-transition="cross-fade">
  Show users
</a>

Animations

In contrast, when we animate a new element without simultaneously removing an old element, we call it an animation.

An example for an animation is opening a new overlay. We can animate the appearance of the dialog by adding an [up-animation] attribute to the opening link:

<a href="/?originalUrl=https%3A%2F%2Funpoly.com%2Fusers"
  up-target=".list"
  up-layer="new"
  up-animation="move-from-top">
  Show users
</a>

Which animations are available?

Unpoly ships with a number of predefined transitions and predefined animations.

You can define custom animations using up.transition() and up.animation().


Guides

Features

Essentials

All features

JS
up.animate(element, animation, [options]) stable

Applies the given animation to the given element.

JS
up.animation(name, animation) stable

Defines a named animation.

JS
up.morph(oldElement, newElement, transition, [options]) stable

Performs an animated transition between two elements.

JS
up.motion.config stable

Sets default options for animations and transitions.

JS
up.motion.finish([element]) stable

Completes animations and transitions.

JS
up:motion:finish stable

This event is emitted on an animating element by up.motion.finish() to request the animation to instantly finish and skip to the last frame.

JS
up.transition(name, transition) stable

Defines a named transition that morphs from one element to another.

HTML
[up-transition] stable

Swaps a fragment with an animated transition.