Card flip

A card rotates around its vertical axis to reveal a back face, with perspective so the edge comes toward the viewer.

CardPress Pure CSS time-based Targets: Web · App All modern browsers
Target
Implement the "Card flip" effect in vanilla HTML/CSS/JS.

Context: A card rotates around its vertical axis to reveal a back face, with perspective so the edge comes toward the viewer.
Trigger: the element is pressed (pointerdown → pointerup).
Timeline: time-based (duration + easing).

Motion tokens (normal):
- rotateY (card): 0deg → 180deg
- duration: 600ms
- easing: cubic-bezier(0.4, 0.2, 0.2, 1)
- note: perspective 1000px on the parent; faces use backface-visibility hidden

Motion tokens (prefers-reduced-motion):
- opacity (front): 1 → 0
- opacity (back): 0 → 1
- duration: 200ms
- easing: ease-out
- note: crossfade, no rotation

Technique: prefer pure CSS transitions/animations; use JS only to toggle classes.

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
- back face content is not focusable while hidden (inert or visibility)
- the trigger is a button; the card announces its state via aria-pressed

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