1681-engine / index / WeatherLayer
Class: WeatherLayer<K> ​
Defined in: src/ambient/WeatherLayer.ts:77
The weather on screen: a capped pool of particles that lives only inside the camera's view, plus a light screen tint for the kinds that change the air. Feed it a WeatherState each frame (from weatherAt, so it fades in and out exactly when every other client's does); the pool is rebuilt only when the kind changes, and a thinning shower hides particles rather than freeing them.
The art is the game's: name texture keys per kind (the pixel module's paintWeatherArt paints a set in whole pixels).
Type Parameters ​
| Type Parameter |
|---|
K extends string |
Constructors ​
Constructor ​
new WeatherLayer<K>(stage, options): WeatherLayer<K>;Defined in: src/ambient/WeatherLayer.ts:88
Parameters ​
| Parameter | Type |
|---|---|
stage | Stage |
options | WeatherLayerOptions<K> |
Returns ​
WeatherLayer<K>
Methods ​
destroy() ​
destroy(): void;Defined in: src/ambient/WeatherLayer.ts:226
Returns ​
void
update() ​
update(
now,
dt,
view,
weather,
share?
): void;Defined in: src/ambient/WeatherLayer.ts:105
now in ms, dt the frame's ms, view the camera's world view. share (0..1) thins the pool on top of the weather's own strength (a reduced-effects setting keeps half).
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
now | number | undefined |
dt | number | undefined |
view | ViewRect | undefined |
weather | WeatherState<K> | undefined |
share | number | 1 |
Returns ​
void