Skip to content

1681-engine / pixel / PaintLayerOptions

Interface: PaintLayerOptions ​

Defined in: src/pixel/paintLayer.ts:8

Properties ​

alive? ​

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

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

Point


depth? ​

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

ts
duration: number;

Defined in: src/pixel/paintLayer.ts:12

How long it plays (ms); its last fadeMs dither away instead of popping out.


every? ​

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

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

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

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

ParameterType
gPixelLayer

Returns ​

void


paint ​

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

ParameterType
gGraphics
msnumber

Returns ​

void

Released under the MIT License.