Skip to main content
rule CX Codex

reactive-displacement — Claude Code rule: what it does, how to install

reactive-displacement — a transition rule where the incoming card's spring also drives the outgoing card, so the swap reads as a hit.

AGPL-3.0 ★ 78,316 updated 2026-10-24

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/reactive-displacement.md
Open on GitHub

What reactive-displacement does

The rule covers a scene change where one card's arrival knocks the previous card off the stage. A single driver tween runs from 0 to 1 with a back.out spring; the incoming card travels in from beyond the edge while the outgoing one slides the other way and fades.

VICTIM_FRACTION sets how much of that driver the exit takes. Between 0.4 and 0.5 the old card is gone before the new one lands, and that gap is what sells the impact; past roughly 0.6 both moves look parallel and the collision idea stops working. Entry length DRIVER_DUR sits at 0.6–1.4 s, bounce coefficient BOUNCE_FACTOR at 1.2–2.0.

The timeline needs GSAP 3.14.2 loaded from CDN. Markup and styles ship with the rule: two cards, victim and intruder, with text injected through placeholders such as {victimHeadline}. Unlike scale-swap-transition, which overlaps two elements with no cause behind it, the exit here is derived from the entry.

What it helps with

  • build a card swap that lands like a hit
  • derive the outgoing card's exit from the incoming spring
  • tune overshoot with a back.out coefficient
  • place the transition after the previous beat resolves
  • drive two motions from one tween in GSAP

Example prompts for the agent

  • Build the card swap with the reactive-displacement rule: the new card flies in from the right and knocks the old one to the left.
  • Set VICTIM_FRACTION near 0.5 so the exit finishes before the incoming card settles.
  • Wire the collide-scene timeline with one back.out spring and placeholders like {intruderHeadline}.

How to install reactive-displacement

Manually: put the files in place

.claude/rules/reactive-displacement.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about reactive-displacement

How do I install reactive-displacement in Claude Code?

Copy .claude/rules/reactive-displacement.md into your project. That is the only step.

What does reactive-displacement do?

It defines a transition where the incoming card's spring also moves the outgoing card, so the exit follows from the entry.

Which GSAP version does the timeline need?

GSAP 3.14.2, loaded from CDN in the script tag that comes with the rule.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set101

The whole set →
scale-swap-transition The scale-swap-transition rule describes a morph-like swap between two DOM elements using a shrinking exit and a springy entrance. Use it for UI state changes. CX Codex +1 ★ 78,316repo stars context-sensitive-cursor context-sensitive-cursor — a rule for typewriter scenes where the caret takes its colour and height from whichever segment of the line is being typed. CX Codex +1 ★ 78,316repo stars cursor-click-ripple cursor-click-ripple supplies GSAP timeline specifications for a moving cursor, button press recoil, and expanding ripple waves. CX Codex +1 ★ 78,316repo stars split-tilt-cards The split-tilt-cards rule builds a two-card 3D split layout with opposing tilt. Use it for comparisons, paired features, or before/after scenes. CX Codex +1 ★ 78,316repo stars hyperframes-media hyperframes-media generates voiceovers, background tracks, sound effects, and subtitles for HyperFrames projects using scripts/audio.mjs. CX Codex +1 ★ 78,316repo stars 3d-text-depth-layers The 3d-text-depth-layers rule builds dimensional typography from offset DOM layers. Use it for large hero headings with stacked depth or animated extrusion. CX Codex +1 ★ 78,316repo stars ai-video-gen ai-video-gen turns a written prompt into a video clip through HeyGen, fal.ai, Kling or Gemini, choosing a gateway for the job. CX Codex +1 ★ 78,316repo stars dynamic-content-sequencing dynamic-content-sequencing computes scene display timing from text length and pacing parameters. It gives longer paragraphs more screen presence without hardcoding frame counts. CX Codex +1 ★ 78,316repo stars

Project sponsors

Companies that keep this analytics open