ludic/light-spot.html
2026-09-17 22:10:03 +00:00

37 lines
No EOL
3.3 KiB
HTML
Raw 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>Light.spot — Ludic</title>
<meta name="description" content="A cone / flashlight light aimed at a direction with a half-angle spread.">
<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> <a href="ns-light.html">Light</a> <span>›</span> <span class="here">Light.spot</span></div>
<div class="item-head">
<span class="kind-badge kind-method">method</span>
<h1 id="top">Light.spot</h1>
</div>
<code class="sig">Light.spot(x, y, radius, color, energy, direction, spread)</code>
<div class="desc"><p>Accumulates a **cone** (spot) light — like <a href="light-point"><code>Light.point</code></a>, but only the wedge aimed at <code>direction</code> degrees (measured from <code>+x</code>, counter-clockwise) within a half-angle of <code>spread</code> degrees receives light. Pixels outside the cone stay dark, and the last few degrees of the edge feather so the boundary is not a hard line. A spot shares every quality control with a radial light — <a href="light-falloff"><code>Light.falloff</code></a>, <a href="light-soft"><code>Light.soft</code></a>, <a href="light-gel"><code>Light.gel</code></a> and the <a href="light-normal"><code>normal buffer</code></a> all apply. Fully deterministic (integer degrees + Q16.16).</p></div>
<div class="params"><h2>Parameters</h2><div class="param" id="param-radius"><code class="pname">radius</code><span class="pdesc">the reach in pixels; brightness is zero at and beyond it</span></div><div class="param" id="param-color"><code class="pname">color</code><span class="pdesc">the light colour, <code>0x00RRGGBB</code></span></div><div class="param" id="param-energy"><code class="pname">energy</code><span class="pdesc">a <code>fixed</code> brightness multiplier (<code>1.0</code> = full)</span></div><div class="param" id="param-direction"><code class="pname">direction</code><span class="pdesc">the aim, in whole degrees (<code>0</code> = right, <code>90</code> = up, <code>180</code> = left)</span></div><div class="param" id="param-spread"><code class="pname">spread</code><span class="pdesc">the cone half-angle, in whole degrees (<code>180</code> ≈ omnidirectional)</span></div></div>
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
property Torch { x: int = 0, y: int = 0 }
model Lamp { Torch }
handler Render phase Update {
Screen.clear(0)
Light.ambient(Color.rgb(24, 24, 32))
Light.spot(80, 60, 70, Color.rgb(255, 240, 200), 1.0, 0, 30) # a flashlight pointing right
Screen.show()
}
}</pre></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>