ludic/ns-camera.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
2.8 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Camera — Ludic</title>
<meta name="description" content="A world-space camera — a draw offset threaded through the render path (the same offset Screen.camera sets).">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Camera</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Camera</h1></div>
<p class="ns-blurb">A world-space camera — a draw offset threaded through the render path (the same offset <a href="screen-camera"><code>Screen.camera</code></a> sets). <a href="camera-set"><code>Camera.set</code></a> places it, <a href="camera-follow"><code>Camera.follow</code></a> eases it toward a target, and <a href="camera-shake"><code>Camera.shake</code></a> jitters it from the seeded RNG for impact and explosions. Everything is integer and deterministic — driven off the same seed and inputs, a replay reproduces the exact camera path, shake included. The camera moves everything drawn; reset it to <code>(0, 0)</code> to draw a fixed HUD.</p>
<div class="ns-methods"><a class="ns-method" href="camera-set.html"><code class="nm-sig">Camera.set(x, y)</code><span class="nm-tip">Place the camera at a world-space offset.</span></a><a class="ns-method" href="camera-follow.html"><code class="nm-sig">Camera.follow(x, y, lerp)</code><span class="nm-tip">Ease the camera toward centring a target point.</span></a><a class="ns-method" href="camera-shake.html"><code class="nm-sig">Camera.shake(amount)</code><span class="nm-tip">Jitter the camera by up to +/- amount pixels (seeded RNG).</span></a><a class="ns-method" href="camera-zoom.html"><code class="nm-sig">Camera.zoom(scale)</code><span class="nm-tip">Scale the whole view about the screen centre by a Q16.16 factor (1.0 = none).</span></a><a class="ns-method" href="camera-shake_for.html"><code class="nm-sig">Camera.shake_for(amount: px, frames: n)</code><span class="nm-tip">Shake for a number of frames, then stop, with no bookkeeping.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>