mwg API
    Preparing search index...

    Function blendMatrix

    • A live, per-frame colour-matrix approximation of a blend towards color (0xRRGGBB) by ratio, the same shape TintedSprite.lerpTint gives an additive-capable sprite, expressed here as a plain matrix so a bare Pixi Sprite can use it too. This is not what applyTextureModifiers uses for ~BLEND itself (that bakes an exact per-pixel blend once, via blendPixels, rather than attaching a runtime filter) - kept as its own export for a game that wants a cheap, adjustable-at-runtime approximation instead of a baked texture, the tradeoff ~CS's colorShiftMatrix already makes for an additive shift.

      Parameters

      • color: number
      • ratio: number

      Returns ColorMatrix

      import { blendMatrix } from '@datamoc/mw_games/two-d/render';
      const matrix = blendMatrix(0xff0000, 0.5); // half-way to red