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="/users"
  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="/users"
  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

HTML
a[up-transition] stable

Follows this link and swaps in the new fragment with an animated transition.

HTML
form[up-transition] stable

Submits this form and swaps in the new fragment with an animated transition.

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(source, target, transition, [options]) stable

Performs an animated transition between the source and target 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.motion.isEnabled() stable

Returns whether Unpoly will perform animations.

JS
up.transition(name, transition) stable

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