Animation

Share via

Use the animation shortcode to show an After Effects animation.

Overview

Use the animation shortcode to show an After Effects animation, powered by Lottie  . The Lottie library supports animations that have been exported as JSON with Bodymovin. The animation uses vector graphics and is responsive. The shortcode is a simplified wrapper of the Lottie library that provides basic functionality. As an example, the following shortcode shows an animation that plays when hovering the mouse over it.

markdown
{{< animation data="animation/gatin.json" auto=false hover=true class="col-6 mx-auto" >}}

Arguments

The shortcode supports the following arguments:

ArgumentRequiredDescription
idNoOptional unique id of the animation element, e.g. lottie-animation-1.
classNoOptional class attribute of the container element.
dataYesRequired path of the JSON file that contains the animation, relative to the static folder.
loopNoFlag to indicate the animation should play in a loop, defaults to true.
autoNoFlag to indicate the animation should start playing automatically, defaults to true.
hoverNoFlag to indicate the animation should start playing when hovering the mouse over it, defaults to false.
titleNoOptional accessible animation title.

Configuration

By default, animation support is optional. Be sure to include lottie in your module configuration and page frontmatter as needed.

Examples

Change the behavior of your animation with shortcode arguments.

Default animation

Assign a valid path to data to provide a JSON file that contains the animation as input. The file should be stored in the static folder, or in one of its subfolders.

markdown
{{< animation data="animation/gatin.json" class="col-6 mx-auto" >}}

Animation on hover

Set auto to false and hover to true to trigger the animation when hovering the mouse over it.

markdown
{{< animation data="animation/gatin.json" auto=false hover=true class="col-6 mx-auto" >}}

Identification

Assign a specific identified to the animation by setting the id argument. The following example assigns the id gatin-animation to the animation.

markdown
{{< animation id="gatin-animation" data="animation/gatin.json" class="col-6 mx-auto" >}}
Last updated: September 24, 2023 • Fix linting errors (3acc35c)