Skip to main content
rule CX Codex

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

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

What 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.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 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.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set101

The whole set →
asr-keyword-glow asr-keyword-glow — a rule that makes words light up and scale up as they get "spoken", driven by per-word timestamps. For promo clips and narrated videos where you need to pace the emphasis. CX Codex +1 ★ 78,316repo stars press-release-spring press-release-spring calculates tactile button animation with linear scaling on tap, GSAP spring bounce on release, and glowing visual cues. Useful when polishing UI interactions. CX Codex +1 ★ 78,316repo stars card-morph-anchor The card-morph-anchor rule describes a container that changes shape as one scene gives way to another. Use it when the morph itself should carry the transition. CX Codex +1 ★ 78,316repo stars svg-icon-enrichment svg-icon-enrichment — a rule that teaches Claude Code and Codex to animate the inner parts of SVG icons: clock hands, scissor blades, pulsing dots, flowing dashes. For micro-animation without swapping the icons themselves. CX Codex +1 ★ 78,316repo stars camera-cursor-tracking The camera-cursor-tracking rule keeps a growing text element in view with a two-stage virtual camera. Use it for search fields, animated URLs, and similar scenes. CX Codex +1 ★ 78,316repo stars seedance-2-5 Skill for generating 4–30 second video clips with ByteDance Seedance 2.5 via fal.ai, Volcengine Ark, Runway, or ComfyUI. CX Codex +1 ★ 78,316repo stars orbit-3d-entry orbit-3d-entry sets up a GSAP animation where items flip in from 3D coordinates and transition into a continuous elliptical orbit around a center point. CX Codex +1 ★ 78,316repo stars motion-graphics motion-graphics is a Claude Code skill that creates short motion-led graphics, from animated headlines and charts to logo stings. For pieces without narration or live-action footage. CX Codex +1 ★ 78,316repo stars

Project sponsors

Companies that keep this analytics open