1681-engine / pixel / PaintLayerOptions
Interface: PaintLayerOptions ​
Defined in: src/pixel/paintLayer.ts:8
Properties ​
alive? ​
optional alive?: () => boolean;Defined in: src/pixel/paintLayer.ts:21
Returning false removes the layer early (its caster gone, its trap sprung).
Returns ​
boolean
at ​
at: () => Point;Defined in: src/pixel/paintLayer.ts:10
Where the layer stands (world px), read every frame: a caster, a projectile, a fixed point.
Returns ​
depth? ​
optional depth?: number | ((y) => number);Defined in: src/pixel/paintLayer.ts:19
Its draw order from the anchor's y (y => y + 45 puts it in front of a body standing there, a negative offset behind it), or a fixed number (an effect lying on the ground under every body). Default y + 45.
duration ​
duration: number;Defined in: src/pixel/paintLayer.ts:12
How long it plays (ms); its last fadeMs dither away instead of popping out.
every? ​
optional every?: number;Defined in: src/pixel/paintLayer.ts:25
Paint only every that many frames (an effect thinned out for performance). Default 1.
fadeMs? ​
optional fadeMs?: number;Defined in: src/pixel/paintLayer.ts:27
The longest fade at the end (ms); it is never more than 30% of the effect. Default 260.
fps? ​
optional fps?: number;Defined in: src/pixel/paintLayer.ts:23
Frames a second it is redrawn at (default 12: hand-animated, like the sprites).
onCreate? ​
optional onCreate?: (g) => void;Defined in: src/pixel/paintLayer.ts:29
Told of the layer as it is made (a game that clears its transient effects on a map change keeps it).
Parameters ​
| Parameter | Type |
|---|---|
g | PixelLayer |
Returns ​
void
paint ​
paint: (g, ms) => void;Defined in: src/pixel/paintLayer.ts:14
Paints one frame ms into the effect, in pixels relative to the anchor.
Parameters ​
| Parameter | Type |
|---|---|
g | Graphics |
ms | number |
Returns ​
void