Skip to content

1681-engine / pixel / ditherVignette

Function: ditherVignette() ​

ts
function ditherVignette(
   w, 
   h, 
   strength?, 
   from?
): Texture;

Defined in: src/pixel/DitherVignette.ts:14

A white dithered edge for a screen of w×h world pixels, one texel a world pixel and scaled up 'nearest'; the sprite that draws it tints it. Made once per size and strength. Returns Texture.EMPTY when the browser has no canvas memory to spare (iOS), so the caller asks again later.

Parameters ​

ParameterTypeDefault value
wnumberundefined
hnumberundefined
strengthnumber1
fromnumber0.55

Returns ​

Texture

Released under the MIT License.