mwg API
    Preparing search index...

    Function paintHazePixels

    • Paint a white haze sheet with per-pixel alpha into pixels (width * height RGBA). The layer tints the sprite itself, so one buffer serves any colour. Pure, like paintFogPixels: density 0 paints fully transparent, and raising the density never thins a pixel that was already covered.

      Parameters

      • pixels: Uint8Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike>
      • width: number
      • height: number
      • paint: HazePaint

      Returns void

      import { paintHazePixels } from '@datamoc/mwg/two-d/render';

      const pixels = new Uint8ClampedArray(4 * 2 * 4);
      paintHazePixels(pixels, 4, 2, { time: 0, density: 1, seed: 3 });
      console.log(pixels.some((v, i) => i % 4 === 3 && v > 0)); // true - full density always shows some haze