Multi state badge

Matt Perry

In this tutorial, we're going to build the Multi state badge example step-by-step.

This example is rated expert difficulty, which means we assume you're already quite familiar with Motion (and JavaScript in general).

Here's a live demo of the example we're going to be creating:

Loading...

Checking Motion+ status…

The Multi state badge tutorial

is exclusive to Motion+

300+ examples & 40+ tutorials

Premium APIs

Motion Studio editing tools

alpha

Discord community

Early access

Lifetime updates

One-time payment, lifetime updates

Already joined?

Introduction

The Multi state badge example shows how to build a dynamic badge component that transitions smoothly between four different states: idle, processing, success, and error. Each state has its own icon, label, and custom animations that bring the badge to life.

This tutorial uses several APIs from Motion: the animate() function for creating smooth animations with spring physics and timing controls, the press() function for handling user interactions, the motionValue() function for reactive animation values, and the transform() utility for mapping values between ranges.

Motion is supported by the best in the industry.