Back to Explore
THE PLAYGROUND · CORE MOTION

Spring

Natural movement that overshoots and settles into place.

SpringCore Motion · Natural movement that overshoots and settles into place. · Secondary effect: rotation.
CLICK
CLICK TO REPLAY · 600 ms
1import { useState } from "react";2import { motion } from "motion/react";3 4const surface = { width: 100, height: 100, borderRadius: 16, background: "#b8ed79", display: "grid", placeItems: "center", color: "#141714" };5 6export default function SpringDemo() {7  const [run, setRun] = useState(0);8  return <div>9    <button onClick={() => setRun(v => v + 1)}>Replay</button>10    <motion.div key={run} style={surface} animate={{11  "x": [12    0,13    100,14    015  ]16}} transition={{ type: "spring", stiffness: 180, damping: 14, mass: 1 }}>Motion</motion.div>17  </div>;18}

Install: npm install motion. Lower damping creates more overshoot; stiffness sets the restoring force.