Skip to content

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 ​

ts
new WeatherLayer<K>(stage, options): WeatherLayer<K>;

Defined in: src/ambient/WeatherLayer.ts:88

Parameters ​

ParameterType
stageStage
optionsWeatherLayerOptions<K>

Returns ​

WeatherLayer<K>

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: src/ambient/WeatherLayer.ts:226

Returns ​

void


update() ​

ts
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 ​

ParameterTypeDefault value
nownumberundefined
dtnumberundefined
viewViewRectundefined
weatherWeatherState<K>undefined
sharenumber1

Returns ​

void

Released under the MIT License.