37 lines
No EOL
2.6 KiB
HTML
37 lines
No EOL
2.6 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Light.time_of_day — Ludic</title>
|
||
<meta name="description" content="Set the ambient tint from a 0..1 time-of-day — a day/night cycle in one value.">
|
||
<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.time_of_day</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Light.time_of_day</h1>
|
||
</div>
|
||
<code class="sig">Light.time_of_day(t)</code>
|
||
<div class="desc"><p>Sets the scene's <a href="light-ambient"><code>ambient</code></a> tint from a single **time-of-day** phase <code>t</code> — a <code>fixed</code> in <code>[0, 1]</code> where <code>0</code> is midnight, <code>0.25</code> dawn, <code>0.5</code> noon and <code>0.75</code> dusk. It ramps a deep-blue night up to full daylight and back over the day, so a game animates one value and the whole world's mood follows, without wiring the ambient colour by hand. It drives the same multiplicative modulate as <code>Light.ambient</code>, so call it once before adding lights. Deterministic (Q16.16 triangle ramp).</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-t"><code class="pname">t</code><span class="pdesc">the time of day, a <code>fixed</code> in <code>[0, 1]</code> (<code>0</code> = midnight, <code>0.5</code> = noon)</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
|
||
property Clock { t: int = 0 }
|
||
model World { Clock }
|
||
handler Render phase Update {
|
||
Screen.clear(Color.rgb(255, 255, 255))
|
||
Light.time_of_day(0.5) # high noon — full daylight
|
||
Light.point(80, 60, 60, Color.rgb(255, 240, 200), 1.0)
|
||
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> |