Spike
Move to another list. Jumps and hits it down on the diagonal.
Bench · 4
On court · 2
Tap a player to move them
- Sport
- Volleyball
- Move
- Jumps and hits it down on the diagonal.
- For
- Move to another list
jump, hit 760ms · squash on landing · reduced: fade
01 Install
npx shadcn@latest add https://moveui-red.vercel.app/r/spike.jsonIt brings the tokens with it. The first time, import the tokens once in your root layout:
import "@/components/moveui/tokens.css";Not using shadcn? Copy the files below into components/moveui/, and tokens.css next to them.
02 Use it
import { spike } from "@/components/moveui/spike/spike";
// 1. Before the move, keep where the item was.
const from = el.getBoundingClientRect();
// 2. Move it to the other list (re-render).
// 3. In a layout effect, on the item in its new place:
spike(newEl, from);03 Or ask your agent
Paste this into Claude Code, Cursor or any coding agent. It installs the piece and wires it in.
Add the Move UI "Spike" piece to this project. It's for: Move to another list.
1. Install it: npx shadcn@latest add https://moveui-red.vercel.app/r/spike.json
2. If the project doesn't import the Move UI tokens yet, add this once to the root layout: import "@/components/moveui/tokens.css";
3. Use it like this, adapted to where it belongs in my code:
import { spike } from "@/components/moveui/spike/spike";
// 1. Before the move, keep where the item was.
const from = el.getBoundingClientRect();
// 2. Move it to the other list (re-render).
// 3. In a layout effect, on the item in its new place:
spike(newEl, from);
Keep its reduced-motion behaviour and keyboard support. Don't hardcode durations, easing or colours: they come from the --ml-* tokens.
Docs: https://moveui-red.vercel.app/pieces/spikeWant your agent to know the whole library and its motion rules? Add the Move UI skill to your project:
npx shadcn@latest add https://moveui-red.vercel.app/r/skill.json04 Code
import "./spike.css";
/**
* Spike (volleyball): call after an item has moved to another list, with the rect it had before the move.
* Sets the jump distance (--dx, --dy, and --_tilt for the side it is hit to) and plays the spike.
*
* const from = el.getBoundingClientRect(); // before the move
* ...move it (re-render)...
* spike(newEl, from); // in a layout effect
*/
export function spike(el: HTMLElement, from: DOMRect) {
const to = el.getBoundingClientRect();
const dx = from.left - to.left, dy = from.top - to.top;
el.style.setProperty("--dx", `${dx}px`);
el.style.setProperty("--dy", `${dy}px`);
el.style.setProperty("--_tilt", dx > 0 ? "1" : "-1");
el.classList.add("ml-spike");
el.removeAttribute("data-spike");
void el.offsetWidth; // restart if it was mid-flight
el.setAttribute("data-spike", "");
el.addEventListener("animationend", () => el.removeAttribute("data-spike"), { once: true });
}
/*
Spike (volleyball): jumps, then hits it down on the diagonal. For moving an item to another list.
Use spike(el, from) from spike.ts after the item has moved: it measures the jump and sets [data-spike].
The item rises off its old place, hangs, then comes down hard into the new one with a small squash.
Reduced motion: it simply appears in its new place with a fade.
*/
.ml-spike[data-spike] {
position: relative;
z-index: 2;
animation: ml-spike var(--ml-dur-flight) both;
}
@keyframes ml-spike {
0% { transform: translate(var(--dx), var(--dy)); box-shadow: 0 0 0 transparent; animation-timing-function: var(--ml-ease-out); }
/* the jump: straight up off the floor */
30% { transform: translate(calc(var(--dx) * 0.92), calc(var(--dy) - 26px)) scale(1.05) rotate(calc(var(--_tilt, 1) * -2deg)); box-shadow: 0 14px 24px -12px oklch(0 0 0 / 0.35); animation-timing-function: cubic-bezier(0.65, 0, 1, 0.5); }
/* the hit: down on the diagonal, squash on landing */
68% { transform: translate(0, 0) scale(var(--ml-impact-x), var(--ml-impact-y)); box-shadow: 0 0 0 transparent; animation-timing-function: var(--ml-ease-out); }
84% { transform: translateY(-2px) scale(calc(2 - var(--ml-impact-x)), calc(2 - var(--ml-impact-y))); }
100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
@keyframes ml-spike { from { opacity: 0; } to { opacity: 1; } }
}
