An engaging and interactive user interface separates a good design from the rest, and micro-interactions have become increasingly important in creating great user interfaces. These micro-animations go a long way in creating a user interface that is not only aesthetic but has great functional value.

The impact of micro-animations

Thoughtful micro-interactions can leave a significant impact on your user experience. We come across numerous micro-animations while browsing through well-designed web pages or apps. Despite being small and often unnoticed, they are vital as they smoothen the user's path through the design, making each step a little easier. They are the small moments where the user and design interact. These micro-details add delight to the user and help pass information or feedback to the user. A state change is an apparent scenario where micro-interactions are used, e.g., opening a menu, liking a post, writing a message, etc.

Animation by Faisal Iqbal on LottieFiles

Lottie animations lead the way in adding high-quality animations to your web pages and menus. These animations are highly scalable, lightweight, and super easy to implement on your web pages. But it is also imperative to be judicious in their usage and optimize them to get the most out of them. It is equally important to have a Lottie player render these animations seamlessly without causing a dent in the performance. While the size of a Lottie animation affects the performance negatively, the way a Lottie player processes and renders the animation also is an important factor.

Animation by Akiko on LottieFiles

The challenges to performance

It is vital that we add the right resources and put them to use with the correct tools to optimize performance. Not doing so can lead to the following:

  • Jittery playback with dropped frames
  • Higher battery drain for mobile devices due to high processor utilization
  • Reduced web page performance due to higher processing overheads to render multiple animations
Animation by LottieFiles

The solution: jLottie

The team at LottieFiles was aware of these challenges and began to create a lightweight player that facilitates a smoother experience and effortlessly handles playback of multiple micro-animations without compensating the performance. The solution to mitigate all of the above issues, our lightweight Lottie player, jLottie!

jLottie Player - Lossless playback for Lottie micro-animations

jLottie is written in JavaScript, and at only 9kb when gzipped, jLottie is perfect as a light addition to any web app. It is suitable as a general-purpose Lottie player with a tiny footprint and excellent performance, but where it truly shines is the lossless playback of micro-animations.

jLottie plays back your Lottie micro-animations without any frame drops by precomputing all the transformations associated with your animations, irrespective of their number. Let us look into some of the fundamental design decisions that jLottie leverages to its advantage.

Lossless Playback: jLottie does not skip frames to keep pace with the required frame rate when playing a Lottie animation. Instead, priority is given to lossless playback over the frame rate requirements.

Scene Graph: jLottie consumes the least possible processing resources by precomputing all the transformations and other animation artifacts before playback. All the precomputed data that depict these transformations and artifacts are enqueued into a scene graph. This scene graph is the only resource used by jLottie to render the Lottie animation. It is one of the main reasons why lossless playback is possible in jLottie, even while dozens of Lottie animations are playing simultaneously.

Use case: Twitter micro-interaction with jLottie

jLottie will enable the use of Lottie across a more comprehensive array of use cases that it was deemed unsuitable for before now. Its efficiency, amplified with the right blend of features for creating a Lottie, makes it suitable for driving user interfaces rich in Lottie micro-animations. Its lossless playback makes it ideal for driving mission-critical interfaces. Let us go through a use case of jLottie to understand its capabilities and the possibilities.

In this demo, we have used jLottie to play our micro-interactions, replacing the once static Twitter icons for commenting, retweeting, and uploading with animated Lottie micro-interactions. You may have also noticed Twitter using an animated heart button. We've got a hold of some of them and played with jLottie!

In the tutorial below, we will guide you through setting up jLottie, checking the compatibility of your animations with jLottie, and implementing them into a website!

Currently, Twitter uses Lottie-web to play these animated hashflags. However, most micro-interactions don't use the full capabilities of Lottie-web and only need a subset of features to work, a need jLottie is aiming to fulfill. From the outset, jLottie was designed to support only the features that specifically position jLottie as a niche player for micro-animations. Here are the features supported by jLottie:

  • Shapes (except ellipse, polystar, repeater, trim paths)
  • Fills (except radial gradient)
  • Strokes (without opacity and dashes)
  • Transforms
  • Interpolation (except roving across time)
  • Masks (limited to path, opacity, and subtract)
  • Layer effects (limited to only fills)

Now experience smooth micro-animations on your web pages and menus without compromising the performance and quality of rendering. Add delight to your user interfaces with jLottie!

Also, jLottie is open-sourced under the MIT License, and all are welcome to use it, contribute to it, or take away ideas from it. Check out the Github page here.

You can get the jLottie player from GitHub or as an NPM Package.

So give jLottie a go and share your experience and suggestions with us in the comment section below.