# coordinate-target-zoom

coordinate-target-zoom — a rule that teaches the agent to zoom into an element displaced from viewport center by pairing scale with counter-translation — the target lands at center after the zoom.

- 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/coordinate-target-zoom.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/coordinate-target-zoom

## What it does

A bare `scale > 1` on a wrapper pushes off-center content off-canvas. The rule defines a method to zoom into a chosen element: an outer wrapper scales the scene, an inner wrapper counters the target's offset with `translate(x, y)` equal to minus the target's displacement from viewport center. The formula is independent of zoom factor — the shift stays the same at 1.5×, 2× or 3×, as long as the outer wrapper's `transform-origin` is set to 50% 50%.

The rule requires measuring the element's real position via `getBoundingClientRect` once after font load — hand calculation works only for symmetric rows of equal-width cards, otherwise it yields the wrong sign. The measurement happens before timeline registration, inside an `async` setup. Without `overflow: hidden` on the scene wrapper, the rule breaks. Peak scale is capped so the target occupies no more than 88% of the frame — a two-pixel centering error at 3× zoom becomes six and shoves the element off-edge.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/coordinate-target-zoom.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/coordinate-target-zoom.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

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

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/coordinate-target-zoom.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/coordinate-target-zoom.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/coordinate-target-zoom.md

## When to use it
- zoom into a card or chip off viewport center so it ends up in the middle of the frame
- scale a non-centered element without pushing it beyond the viewport boundary
- pair scale with compensating translate for focus animation on an offset target

## Example prompts
- Add a 2.5× zoom into `target-card` — it sits on the right, but needs to land at center.
- Enlarge the third price out of four in a row, 5-second scene — element is offset right, measure its displacement.
- Focus on `#winner-badge` — it's on the side, timeline should center it after zoom.

## Similar
- [control-target-sync](https://affpapa.org/en/nevibecode/rules/control-target-sync.md) — rule · ★ 328 repo stars
- [zoom-apps-sdk](https://affpapa.org/en/nevibecode/skills/anthropics-zoom-apps-sdk.md) — skill · 2200 installs
- [build-zoom-contact-center-app](https://affpapa.org/en/nevibecode/skills/anthropics-build-zoom-contact-center-app.md) — skill · 2200 installs
- [zoom-virtual-agent-web](https://affpapa.org/en/nevibecode/skills/zoom-virtual-agent-web.md) — skill · ★ 8052 repo stars
- [build-zoom-virtual-agent](https://affpapa.org/en/nevibecode/skills/build-zoom-virtual-agent.md) — skill · ★ 8052 repo stars
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1600000 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
