List reorder (FLIP)

When a list is re-sorted, each row glides from its old position to its new one instead of snapping.

ListPress Web Animations APIVanilla JS time-based Targets: Web · App All modern browsers
  • Alpha82
  • Bravo47
  • Charlie95
  • Delta63
Target
Implement the "List reorder (FLIP)" effect in vanilla HTML/CSS/JS.

Context: When a list is re-sorted, each row glides from its old position to its new one instead of snapping.
Trigger: the element is pressed (pointerdown → pointerup).
Timeline: time-based (duration + easing).

Motion tokens (normal):
- translateY (each row): old position − new position → 0
- duration: 400ms
- easing: cubic-bezier(0.2, 0.8, 0.2, 1)
- note: First, Last, Invert, Play: measure before and after the DOM change, animate the inverse delta to zero

Motion tokens (prefers-reduced-motion):
- translateY: — → rows jump; optional 150ms opacity fade
- duration: 0ms

Technique: plain JavaScript (requestAnimationFrame / class toggles), no animation library required; Web Animations API is acceptable.

Acceptance:
- animate only transform and opacity unless the spec lists other properties
- no layout shift; content is visible without the animation
- when prefers-reduced-motion is set, use the reduced tokens only
- rows are moved in the DOM (or state) first; only transforms animate
- a reorder during an in-flight animation cancels and restarts cleanly

Generated from the spec. Prompts differ by target name only; the tokens are the source of truth.