pixi-reels

composeMasks()

pixi-reels


pixi-reels / index / composeMasks

Function: composeMasks()

function composeMasks(...strategies: MaskStrategy[]): DrawableMaskStrategy;

Defined in: core/maskStrategies.ts:768

Union several strategies into one mask.

Union only. A PixiJS Graphics mask is the union of every filled shape in it, and there is no way to intersect or subtract the output of two independent strategies. (Graphics.cut() subtracts a hole from a path within one strategy - see PathMaskStrategy - which is the tool for that job.)

The motivating case is a reel set plus a detached banner or side cell that has to share the viewport’s single mask.

Parameters#

ParameterType
strategiesMaskStrategy[]

Returns#

DrawableMaskStrategy

Example#

builder.maskStrategy(composeMasks(
  new SilhouetteMaskStrategy({ radius: 20 }),
  new PathMaskStrategy((g, ctx) => {
    g.roundRect(0, -90, ctx.width, 70, 12).fill({ color: 0xffffff });
  }),
))