Skip to main content
rule CX Codex

scale-swap-transition — Claude Code rule

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.

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/scale-swap-transition.md
Open on GitHub

What scale-swap-transition does

The rule defines a morph-like replacement for two DOM elements without SVG path interpolation. The outgoing element shrinks and fades, while the incoming one grows from the same scale anchor with a spring overshoot. A short overlap keeps the handoff from looking like a hard cut.

Its example combines an HTML card structure, CSS for stacking and shared transform origin, and a GSAP timeline. Inner text appears after the new card settles, while a brand line can fade in before the swap. The pattern also covers a three-state A→B→C sequence and a flatter opacity-and-color variant.

The timeline version requires GSAP, since its animation sequence is built with gsap.timeline. The rule is about coordinated DOM transitions, not SVG shape interpolation.

What it helps with

  • replace one card with another without a hard cut
  • coordinate the exit and entrance scales
  • reveal a subline after the new card settles
  • chain an A→B→C state sequence
  • swap same-shaped states with opacity and color

Example prompts for the agent

  • Implement a scale-swap-transition between #outgoing and #incoming.
  • Create the GSAP timeline and reveal #sub after the incoming card settles.
  • Adapt the pattern for an A→B→C cycle with overlapping transitions.

How to install scale-swap-transition

Manually: put the files in place

.claude/rules/scale-swap-transition.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 scale-swap-transition

How do I install scale-swap-transition in Claude Code?

Create the rule file at .claude/rules/scale-swap-transition.md and place its contents there.

What does scale-swap-transition do?

It describes a DOM-element swap where the outgoing element shrinks and fades while the incoming element grows in with a spring effect.

Which platforms support scale-swap-transition?

The rule targets Claude Code and Codex. Its animation example uses GSAP.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set101

The whole set →
embedding embedding instructs your coding agent to debug ManimGL scenes interactively via IPython, letting you test object positions and animations without restarting the render. CX Codex +1 ★ 78,316repo stars vertical-spring-ticker vertical-spring-ticker is a rule for Claude Code and Codex that defines a slot-machine vertical ticker with additive GSAP spring physics. Each spring advances the stack one discrete step instead of a smooth scroll. CX Codex +1 ★ 78,316repo stars multi-phase-camera multi-phase-camera — a rule for animated web scenes: the camera moves through 2-3 zoom phases (pull-back, focus, push) with continuous micro-drift on top. For when a single linear zoom feels mechanical. CX Codex +1 ★ 78,316repo stars camera Reference rule for ManimGL CameraFrame controls. Helps write 2D pans, zoom sequences, and 3D view changes without syntax errors. 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 reactive-displacement reactive-displacement — a transition rule where the incoming card's spring also drives the outgoing card, so the swap reads as a hit. CX Codex +1 ★ 78,316repo stars

Project sponsors

Companies that keep this analytics open