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
.claude/rules/reactive-displacement.mdWhat 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.outcoefficient - 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_FRACTIONnear 0.5 so the exit finishes before the incoming card settles. - Wire the
collide-scenetimeline with oneback.outspring and placeholders like{intruderHeadline}.
How to install reactive-displacement
Manually: put the files in place
.claude/rules/reactive-displacement.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/reactive-displacement.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/reactive-displacement.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/reactive-displacement.mdManually: put the files in place
.clinerules/reactive-displacement.mdStep 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.