Skip to content

No.115 · Cards

Depth Card

A destination card that is a little diorama: tilt it and the sky, ridges and foreground slide past each other at different speeds.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: Dusk

Build a destination card (21rem, 4:5, 24px radius, one link) that works like a diorama. The picture is an SVG landscape built in layers — a sky gradient, a sun with a soft glow, far ridges, mid ridges, a near ridge with a small village on the rim, and a foreground of rocks and a palm — each layer in its own group. Pointer position over the card (−1…1 on both axes) is smoothed on a spring (stiffness 0.09, damping 0.78) and written to --px/--py; each layer translates opposite the pointer by its depth (4px for the sun up to 46px for the foreground, 60% as much vertically), the whole card tilts in perspective (±7° Y, ±6° X), a soft-light highlight follows, and the text block drifts a little the other way. Leaving springs it back. The scene is drawn 6% oversize so edges never show. The text sits on a bottom gradient: a frosted badge, an Instrument Serif title and a meta line. The loop sleeps once settled; reduced motion keeps it flat. Selected variant — Dusk (dusk): Dusk: a violet-to-apricot sky (#2b1b4a → #f29b6b), pale gold sun, ridges stepping from mauve (#a8607a) through plum to near-black violet, warm white text. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Move across the card to tilt it and open up the layers; leave and it settles. Motion: Spring stiffness 0.09, damping 0.78; layer travel 4–46px by depth; tilt ±7°. Accessibility: One link with a real heading; the illustration is aria-hidden. Reduced motion keeps the card still. Responsive behavior: Fills narrower screens up to 21rem and keeps its 4:5 shape; the SVG crops to cover. Touch: No tilt on touch; the card is a normal tappable link. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Move across the card to tilt it and open up the layers; leave and it settles.
Motion
Spring stiffness 0.09, damping 0.78; layer travel 4–46px by depth; tilt ±7°.
Accessibility
One link with a real heading; the illustration is aria-hidden. Reduced motion keeps the card still.
Responsive
Fills narrower screens up to 21rem and keeps its 4:5 shape; the SVG crops to cover.
On touch
No tilt on touch; the card is a normal tappable link.