What is @pixi/filter-alpha?
@pixi/filter-alpha is a filter for the PixiJS library that allows you to adjust the alpha (transparency) of display objects. This can be useful for creating fade effects, highlighting, or other visual effects that require changing the transparency of elements in a PixiJS application.
Adjusting Alpha Transparency
This code sample demonstrates how to apply an alpha filter to a sprite in a PixiJS application. The AlphaFilter is set to 0.5, making the sprite 50% transparent.
const app = new PIXI.Application();
document.body.appendChild(app.view);
const sprite = PIXI.Sprite.from('path/to/image.png');
app.stage.addChild(sprite);
const alphaFilter = new PIXI.filters.AlphaFilter(0.5);
sprite.filters = [alphaFilter];