mwg API
    Preparing search index...

    Function spriteColorMatrix

    • Attaches matrix to sprite as a ColorMatrixFilter, so a caller using colorShiftMatrix/channelScaleMatrix/blendMatrix/channelSwapMatrix never has to name pixi.js itself just to construct the one filter class those matrices are shaped for (item 309) - the same reasoning two-d/pixi-interop.ts gives for the rest of the interop boundary. Replaces sprite.filters outright, the same trade-off applyImageModifiers's ~GS already accepts (see its own fix, item 288): a caller layering its own filter keeps that filter's job, not this one's.

      Parameters

      • sprite: Sprite
      • matrix: ColorMatrix

      Returns void

      import { Sprite } from 'pixi.js';
      import { blendMatrix, spriteColorMatrix } from '@datamoc/mw_games/two-d/render';

      const sprite = new Sprite();
      spriteColorMatrix(sprite, blendMatrix(0xff0000, 0.5)); // half-blended red, no pixi.js import needed for the filter itself