1681-engine / index / Afterimages
Class: Afterimages ​
Defined in: src/fx/Afterimages.ts:34
Afterimages of a moving body — a dash, a blink, a quick step: copies of its current frame left behind as flat silhouettes in a tint, fading out. A copy is its frame's cached solid silhouette (solidSilhouette) tinted, not a fill filter, so a trail costs no render pass per copy; copies are pooled rather than made every few ms, and a live body's frames are snapshotted into a fixed ring of textures instead of a new canvas each time.
Constructors ​
Constructor ​
new Afterimages(stage, options?): Afterimages;Defined in: src/fx/Afterimages.ts:51
Parameters ​
| Parameter | Type |
|---|---|
stage | Stage |
options | AfterimagesOptions |
Returns ​
Afterimages
Accessors ​
active ​
Get Signature ​
get active(): number;Defined in: src/fx/Afterimages.ts:98
Copies still fading.
Returns ​
number
Methods ​
destroy() ​
destroy(): void;Defined in: src/fx/Afterimages.ts:142
Takes every copy off the stage and frees the ring's textures.
Returns ​
void
trail() ​
trail(
body,
x,
y,
now,
depth?
): Image | null;Defined in: src/fx/Afterimages.ts:70
Leaves a copy of body as drawn now, standing at world (x, y) with draw order depth (default just behind a body sorted by y), unless one was left less than spacingMs before now. Answers the copy, or null when none was laid (too soon, or the frame could not be read): a caller drawing its own speed streaks between copies follows that.
Parameters ​
| Parameter | Type |
|---|---|
body | Image |
x | number |
y | number |
now | number |
depth | number |
Returns ​
Image | null