Documentation

Documentation

Error

Mini animate() doesn't support type: "spring"

Mini animate() doesn't support type: "spring"

You've received the following message:

Mini animate() doesn't support "type" as a string.

Mini animate() doesn't support type: "spring"

You're using the mini animate() function and you've set type: "spring".

animate(
  element,
  { transform: "translateX(100px)" },
  { type: "spring" }
)

Explanation

The mini animate() function is built exclusively on the Web Animations API. It's designed to be as small as possible, while maintaining as many features from the hybrid WAAPI/JS animate() function as possible.

To hit this tiny bundlesize, spring animations are not included by default.

Solution

Import spring from "motion":

import { animate } from "motion/mini"
import { spring } from "motion"

Then set type directly to the imported spring:

animate(
  element,
  { transform: "translateX(100px)" },
  { type: spring }
)

Level up your animations with Motion+

Access to 100+ premium examples, exclusive APIs like Cursor, private Discord and GitHub, and powerful VS Code animation editing tools.

One-time payment, lifetime updates.

Stay in the loop

Subscribe for the latest news & updates.

Stay in the loop

Subscribe for the latest news & updates.

Stay in the loop

Subscribe for the latest news & updates.