Animation

A collection of smooth animations to use within your page.

Table of contents

Usage

Add one of the .uk-anmt-* classes to any element. The animation is shown when the class is added, so usually immediately on page load. To show the animation at another point, for example when the element enters the viewport, you would add the class using JavaScript — with the Scrollspy component for instance. This is what happens in many of UIkit’s components that make use of animations. All animations themselves are implemented with CSS, so they do not require JavaScript to play.

ClassDescription
.uk-anmt-fadeThe element fades in.
.uk-anmt-scale-up
.uk-anmt-scale-down
The element fades in and scales up or down.
.uk-anmt-slide-top
.uk-anmt-slide-bottom
.uk-anmt-slide-left
.uk-anmt-slide-right
The element fades and slides in from the top, bottom, left or right by its own height or width.
.uk-anmt-slide-top-sm
.uk-anmt-slide-bottom-sm
.uk-anmt-slide-left-sm
.uk-anmt-slide-right-sm
The element fades and slides in from the top, bottom, left or right with a smaller distance which is specified by a fixed pixel value.
.uk-anmt-slide-top-md
.uk-anmt-slide-bottom-md
.uk-anmt-slide-left-md
.uk-anmt-slide-right-md
The element fades and slides in from the top, bottom, left or right with a medium distance which is specified by a fixed pixel value.
.uk-anmt-kenburnsThe element scales very slowly up without fading in.
.uk-anmt-shakeThe element shakes.
.uk-anmt-strokeThe SVG element strokes are drawn.

To toggle an animation on hover or focus, add the .uk-anmt-toggle class to a parent element. Also add `tab to make the animation focusable through keyboard navigation and on touch devices.

Reverse modifier

By default, all animations are incoming. To reverse any animation, add the .uk-anmt-reverse class.

Fast modifier

To play animations at a faster speed, add the .uk-anmt-fast class to the element.

Origin modifiers

By default, scaling animations originate from the center. To modify this behavior, add one of the .uk-transform-origin-* classes from the Utility component.

Ken Burns

To add a simple Ken Burns effect, add the .uk-anmt-kenburns class to any image. You can also apply the .uk-anmt-reverse or one of the .uk-transform-origin-* classes from the Utility component to modify the effect.

By default, the animation starts on page load. In this example we used the Scrollspy component, to toggle the effect when the image enters the view.

SVG Strokes

The Animation component can be used to animate SVG strokes. The effect looks like the SVG strokes are drawn before your eyes. The SVG image has to be injected into the markup as an inline SVG. This can be done manually or using the SVG component.

The following example shows how to add the inline SVG manually. Since you have to know the exact length of the stroke, UIkit requires you to set the length in the custom property --uk-anmt-stroke. In this example the stroke length is 46.

A much easier way is to use the SVG component by adding uk-svg="stroke-animation: true" to the image element. It will calculate the stroke length and add the --uk-anmt-stroke custom property automatically.

Customize

Customize your Franken UI experience.