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

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 78316 repo stars
- Author: calesthio
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/calesthio/OpenMontage/tree/HEAD/.agents/skills/hyperframes-animation/rules/scale-swap-transition.md
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/scale-swap-transition

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

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/scale-swap-transition.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/scale-swap-transition.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/scale-swap-transition.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/scale-swap-transition.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/scale-swap-transition.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/calesthio/OpenMontage/tree/HEAD/.agents/skills/hyperframes-animation/rules/scale-swap-transition.md

## When to use it
- 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
- 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.

## Similar
- [paper-cinder-transition](https://affpapa.org/en/nevibecode/skills/paper-cinder-transition.md) — skill · 678 installs
- [transition-sequences](https://affpapa.org/en/nevibecode/skills/transition-sequences.md) — skill · 653 installs
- [svg-animation](https://affpapa.org/en/nevibecode/skills/svg-animation.md) — skill · 4400 installs
- [accessible-animation](https://affpapa.org/en/nevibecode/skills/accessible-animation.md) — skill · 4400 installs
- [modern-web-design](https://affpapa.org/en/nevibecode/skills/modern-web-design.md) — skill · 3200 installs
- [animate-text](https://affpapa.org/en/nevibecode/skills/animate-text.md) — skill · 2800 installs

From the same set: [calesthio/openmontage](https://affpapa.org/en/nevibecode/by/calesthio/openmontage.md) — 101 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
