browser-camera-2d
/browser-camera-2d
Ustawia w grze 2D lub pikselowej kamerę, która podąża za postacią, z martwą strefą, wyprzedzeniem i zoomem, bez 3D.
- Autor
- PixelWao ↗
- Repozytorium
- codex-gamedev-skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 30.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 14
- Skrypty
- 3
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 30.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 3 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: scripts/camera2d.d.ts, scripts/camera2d.mjs, tests/camera2d.test.mjs
Co robi i kiedy
Ustawia w grze 2D lub pikselowej kamerę, która podąża za postacią, z martwą strefą, wyprzedzeniem i zoomem, bez 3D.
Oryginalny opis (EN)
Use for Canvas 2D or pixel-art camera follow, deadzones, look-ahead, zoom, bounds and teleport handling; not 3D camera rigs.
Jak działa
- Procedure
- Bundled implementation
- Non-goals and protection rules
- Exit criteria
Podgląd SKILL.md
--- name: browser-camera-2d description: Use for Canvas 2D or pixel-art camera follow, deadzones, look-ahead, zoom, bounds and teleport handling; not 3D camera rigs. --- # Browser Camera 2D Provide a camera controller without replacing the game's renderer, physics engine, player controller, or main loop. Start by inspecting the project's camera/update/resize architecture and existing settings. Never silently replace a working camera or change gameplay physics. ## Procedure 1. **Inspect** Canvas CSS dimensions vs backing buffer, DPR, world-to-screen conventions, the active fixed-timestep and interpolation policy, camera ownership, zoom semantics, UI layers and game bounds. 2. **Reproduce** symptoms (jitter, frame-independent smoothing issues, level-edge peeking, look-ahead jerk, zoom defects) with a fixed seed and before-metrics. 3. **Choose** behavior: horizontal/vertical deadzones, separate easing for look-ahead, exponential following `alpha = 1 - exp(-rate * dt)`, zoom limits, grounded vs airborne framing, explicit cuts for portals and respawns. 4. **Integrate** `scripts/camera2d.mjs` or its documented algorithm *inside the existing loop*. Feed render-interpolated player transforms when fixed physics and render FPS differ. Use the same interpolation convention as the game; do not interpolate across teleports. 5. **Render** by clearing the Canvas in identity transform, then applying `Camera2D.applyCanvasTransform(ctx)` only for world draw calls. Restore identity before drawing screen-space HUD; account for DPR in viewport units (see `references/canvas-integration.md`). 6. **Clamp** based on visible half-extents including zoom. If a map is smaller than the viewport, center it on that axis and allow intentional letterboxing; apply shake *before* final clamp. Keep camera and visual-shake offsets distinct. 7. **Verify** at 30/60/144 Hz, variable aspect ratio, zoom, small maps, portal cuts, sudden reversals and pause. Run `node --test tests/*.test.mjs`; consider `camera-debugging-qa` for telemetry if installed, but no dependency is required. ## Bundled implementation - `scripts/camera2d.mjs` — dependency-free camera, target interpolation and coordinate conversion. - `scripts/camera2d.d.mts` — TypeScript types for the `.mjs` module. - `examples/canvas-integration.mts` — typed wiring sketch (requires Canvas / browser, not runnable as standalone). - `references/canvas-integration.md` — render order, device pixels and portals. - `references/godot-unity.md` — Godot and Unity analogies with explicit API boundaries. ## Non-goals and protection rules - Physics/pathfinding is upstream; do not update position, impulses or collision layers here. - Screen shake *intensity and triggers* belong to game feel; this skill only accepts an offset. - Camera samples **visual interpolated** targets, not a second simulated world. - Do not change FPS, switch to an unrelated renderer, add a competing RAF loop, or adjust scene logic to hide camera bugs. - Report before/after reproduction steps and any features unverified in the target browser/device. ## Exit criteria All target sizes finite, no undefined positions, UI remains stable, bounds obey design, teleports snap without interpolation streaks, look-ahead reversals ease, coordinate transforms round-trip, and no change to physics tick. Never claim GPU/browser certification based only on Node tests.
Pliki w paczce (14)
- CHANGELOG.md 1 KB
- LICENSE 1 KB
- PROVENANCE.md 1 KB
- README.md 1 KB
- SKILL.md 3 KB
- attribution/upstream/LICENSE 11 KB
- attribution/upstream/NOTICE 1 KB
- examples/canvas-integration.mts 1 KB
- references/canvas-integration.md 3 KB
- references/godot-unity.md 1 KB
- scripts/camera2d.d.mts 1 KB
- scripts/camera2d.d.ts 1 KB
- scripts/camera2d.mjs 4 KB
- tests/camera2d.test.mjs 3 KB
Wersje
W bazie nie ma innych skilli o nazwie browser-camera-2d.
Migawka bazy z 13.11.2026 · wersja paczki b233f7f9ad2a (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100camera-systems
Buduje kamery w grach: podążanie 2D z martwą strefą, wyprzedzanie, wygładzanie, orbitę 3D, pierwszą osobę i kadrowanie wielu celów. - 100camera-systems
Buduje kamery do gier: śledzenie 2D z martwą strefą, orbita 3D z kolizjami, widok z pierwszej osoby, kadrowanie wielu celów i wstrząsy. - 100godot-orthographic-follow-camera
Ustawia ortograficzną kamerę Camera3D pod stałym kątem na pivocie, który płynnie podąża za celem, jako domyślną kamerę gier 3D pixel art z widokiem z góry lub izometrycznym. - 100camera-debugging-qa
Mierzy w gierach drgania kamery, błędy podążania, granice i teleportacje na podstawie śladów, bez budowania rigu kamery. - 100character-camera
Dodaje do sceny w Three.js kamerę pierwszej osoby lub orbitalną trzeciej osoby, sterowaną myszą i płynnie podążającą za postacią. - 100camera-pan-zoom-controls
Dodaje panoramowanie, zoom i ograniczenia do kamery izometrycznej, aby świat pozostawał ostry i mieścił się w granicach na różnych rozmiarach ekranu.