# viewport-change

viewport-change — a rule that teaches the agent a virtual camera in GSAP scenes: zoom, pan and focus-lock on a moving element, all through one wrapper.

- 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/viewport-change.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/viewport-change

## What it does

This rule sets up a virtual camera for an HTML and GSAP scene. All scene content sits inside one `.world` block, and the agent moves that block opposite to the camera you want. Pan right and the block slides left. Zoom in and it gets `scale` above 1. To follow an element, the X offset is recalculated every frame.

Camera state lives in a `cam` object with `scale`, `x` and `y`. `applyCamera()` turns it into `translate(x, y) scale(S)`, and a GSAP tween updates the object through `onUpdate`. CSS applies the scale first, so centering a target takes `T = -offset × S`. The rule ships HTML, CSS and a three-phase timeline skeleton, plus a scale table: 1.02 to 1.05 is barely noticeable, 1.5 to 2.5 fills the screen with the element.

The formula is specific to this rule. `coordinate-target-zoom` uses two nested wrappers and `T = -offset`, so copying one setup into the other pushes the target off center. For 2-3 discrete phases with drift there is a separate rule, `multi-phase-camera`. Placeholders such as `{Brand}` and `HERO_FONT_SIZE` need your own values.

## Install

### Claude Code (native platform)

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

### GitHub Copilot

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

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/viewport-change.md`

### Cline

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

## When to use it
- zoom the camera onto the `#cta` button at the end of a clip
- pan the whole frame right with one wrapper instead of moving each element
- keep a moving cursor at a fixed screen X
- combine two scale tweens into one compound zoom
- pick a zoom strength from a scale table

## Example prompts
- Add a virtual camera to `viewport-scene` with the `viewport-change` rule and zoom in on `#cta`.
- Make the camera follow `.moving-cursor` and hold it at a fixed screen X, following `viewport-change`.
- Pan the scene right with a single transform on `.world`, per `viewport-change`.

## Similar
- [mobile-native](https://affpapa.org/en/nevibecode/skills/mobile-native.md) — skill · 141900 installs
- [responsive-designer](https://affpapa.org/en/nevibecode/plugins/responsive-designer.md) — plugin · ★ 2858 repo stars
- [mobile-friendly](https://affpapa.org/en/nevibecode/skills/mobile-friendly.md) — skill · 1100 installs
- [viewports](https://affpapa.org/en/nevibecode/skills/viewports.md) — skill · 180 installs
- [figma](https://affpapa.org/en/nevibecode/skills/heygen-com-figma.md) — skill · 466500 installs
- [ui-ux-pro-max](https://affpapa.org/en/nevibecode/skills/ui-ux-pro-max.md) — skill · 455900 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
