physics-press-reaction — Claude Code rule: what it does and setup
physics-press-reaction synchronizes cursor and element compression in GSAP using shared spring scaling. Controls approach trajectory, simultaneous press down, and bouncy release.
AGPL-3.0 ★ 78,316 updated 2026-10-24
.claude/rules/physics-press-reaction.mdWhat physics-press-reaction does
This rule structures a simulated pointer click event within an animated UI scene. Rather than scaling a button in isolation, an SVG cursor approaches the element center and compresses simultaneously with the target. Both items scale down together according to 1 - PRESS_INTENSITY, then spring back to full size using an overshoot ease.
The template combines an HTML scene container, CSS transform setups, and a timeline powered by GSAP. Four sequential phases drive the interaction: cursor approach, synchronized compression, spring release via back.out, and shadow shifts. Alternate patterns accommodate extended hold states, pulsing glows, and chained interactions across multiple buttons.
Timing constraints determine whether the motion feels physical. The compression start point PRESS_DOWN_AT must exactly equal the approach start time plus approach duration. Violating this timing causes the cursor to compress mid-air before reaching its target.
What it helps with
- synchronize cursor and button compression during interaction
- structure GSAP timeline phases for approach, press, and rebound
- animate button shadow changes during compression
- implement hold-press delays with pulsing inner glows
Example prompts for the agent
- Generate a synchronized cursor click animation based on physics-press-reaction.
- Configure a GSAP timeline with a hold phase and pulsing button glow.
- Create a sequential two-button interaction with cursor translation.
How to install physics-press-reaction
Manually: put the files in place
.claude/rules/physics-press-reaction.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/physics-press-reaction.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/physics-press-reaction.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/physics-press-reaction.mdManually: put the files in place
.clinerules/physics-press-reaction.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about physics-press-reaction
How do I install physics-press-reaction in Claude Code?
Save the rule file into .claude/rules/physics-press-reaction.md. Claude Code automatically loads rules found in that directory.
What is the difference between physics-press-reaction and press-release-spring?
The press-release-spring rule animates isolated element compression without a pointer. This rule synchronizes the approach and matched compression of both cursor and target.
Which animation library is required to run the output?
The generated timeline relies on the GSAP animation library. The rule template imports [email protected] via CDN script tag.