camera-pan-zoom-controls — Claude Code skill: pan, zoom
Skill for isometric cameras: drag-to-pan, scroll-to-zoom toward the cursor, and clamp to map bounds. Keeps tiles pixel-aligned, no shimmer.
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a claude-codeWhat camera-pan-zoom-controls does
Implements a camera as offset (x, y) and scale (zoom), applied once per frame before drawing through a context transform. Panning responds to mouse drag, zooming to scroll anchored at the cursor position. Offset and scale are clamped to map bounds so the view stays within the world.
Pixel alignment is critical. Subpixel camera offsets cause tile shimmer. The final transform snaps to whole pixels before rendering. The inverse transform feeds into tile-picking-interaction for accurate object selection.
The skill enforces three checks: drag pans and scroll zooms toward the cursor (not screen center), the camera stays within bounds at all zoom levels, and transforms snap to whole pixels without shimmer.
What it helps with
- Implement pan with mouse drag on an isometric map
- Add zoom that follows the cursor position
- Prevent the camera from panning outside map boundaries
- Eliminate tile shimmer during camera movement
Example prompts for the agent
- Add pan and zoom controls to an isometric camera with boundary clamping
- Make zoom anchor to the cursor, not the screen center
- Set up camera transforms to stay pixel-aligned and prevent tile shimmer
How to install camera-pan-zoom-controls
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a claude-code2Manually: put the files in place
~/.claude/skills/camera-pan-zoom-controls/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/camera-pan-zoom-controls/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a codex2Manually: put the files in place
.agents/skills/camera-pan-zoom-controls/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a cursor2Manually: put the files in place
.cursor/skills/camera-pan-zoom-controls/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install 0xheycat/isometric-game-skills camera-pan-zoom-controls2Manually: put the files in place
.github/skills/camera-pan-zoom-controls/SKILL.md1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a gemini-cli2Platform CLI
gemini skills install https://github.com/0xheycat/isometric-game-skills --path skills/camera-pan-zoom-controlsManually: put the files in place
.devin/skills/camera-pan-zoom-controls/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about camera-pan-zoom-controls
How do I install camera-pan-zoom-controls in Claude Code?
Run npx skills add 0xheycat/isometric-game-skills --skill camera-pan-zoom-controls -a claude-code, then open ~/.claude/skills/camera-pan-zoom-controls/SKILL.md.
What does camera-pan-zoom-controls do?
The skill implements a camera with mouse drag (pan), scroll (zoom toward cursor), and bounds clamping. All transforms snap to whole pixels to prevent tile shimmer.
Why should zoom anchor to the cursor instead of screen center?
Cursor-anchored zoom matches user expectations. Center zoom feels unnatural. The skill shows how to keep the point under the cursor stationary during zoom.
Source text
SKILL.md · MIT
--- name: camera-pan-zoom-controls description: Use when adding pan, zoom, and clamping to an isometric camera so the world stays crisp and within bounds across screen sizes. license: MIT --- # Camera Pan & Zoom Controls ## Overview A camera is a single transform applied before drawing. This skill implements pan (drag), zoom (toward cursor), and clamping to map bounds, keeping tiles pixel-aligned to avoid shimmer. ## When to Use - The world is bigger than the screen. - You need drag-to-pan and scroll-to-zoom. - Tiles shimmer or the camera leaves the map. ## Process 1. Represent the camera as offset (x, y) and scale (zoom). 2. Apply it once per frame before drawing (translate then scale). 3. Pan by adding drag delta to the offset. 4. Zoom toward the cursor: adjust offset so the point under the cursor stays put. 5. Clamp offset and zoom so the view never leaves the map bounds. 6. Snap the final transform to whole pixels to avoid tile shimmer. 7. Feed the inverse transform into `tile-picking-interaction`. ```js ctx.setTransform(zoom,0,0,zoom, -cam.x*zoom, -cam.y*zoom); ``` ## Rationalizations (Stop Lying to Yourself) | Excuse | Reality | |---|---| | "Zoom toward center is fine" | Users expect zoom toward the cursor. Anchor the zoom point. | | "Clamping is optional" | Without clamps the player pans into the void. Clamp to bounds. | ## Red Flags - STOP if you catch yourself: - Zoom anchored to screen center, not cursor. - No bounds clamping. - Sub-pixel camera offsets causing shimmer. ## Verification You are NOT done until every box is checked: - [ ] Drag pans and scroll zooms toward the cursor. - [ ] Camera is clamped within map bounds at all zooms. - [ ] Transform snaps to whole pixels (no shimmer).
© 0xheycat · MIT · 0xheycat/isometric-game-skills