makeAtmosphereTransition()
Change weather smoothly. The game decides when to call set; the transition only blends (see blendAtmosphere: a change of precipitation kind fades one out before the other fades in, and wind turns the short way round).
function makeAtmosphereTransition(start?: Atmosphere): AtmosphereTransition;Defined in: engine/src/atmosphere/weather.ts:131
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
start? | Atmosphere | ATMOSPHERES.clear | Default ATMOSPHERES.clear. |
Returns
The transition; call update(dt) once per frame.
Example
const weather = makeAtmosphereTransition(ATMOSPHERES.clear);
weather.set(ATMOSPHERES.rain, 6);
// per frame:
const sky = weather.update(dt);
wetness = approach(wetness, sky.precipitation.kind === "rain" ? 1 : 0, 0.1, dt);
renderer.render({ ...frame(), ...atmosphereFrame(timeOfDay(phase), { ...sky, wetness }), time });
loop.setContinuous(weather.changing() || sky.precipitation.intensity > 0);blendAtmosphere()
Blend two atmospheres. A change of precipitation kind fades one out before the other fades in.
timeOfDay()
Every lighting field of the renderer's FrameParams for a time of day: key light, ambient, sun and moon discs, sky colours. By day the key light follows the sun; at night it is a dim blue moonlight and the ambient drops low enough for point lights to carry the scene. The moon disc lights nothing;...