import * as PIXI from 'pixi.js';
const app = new PIXI.Application({ resizeTo: window });
document.body.appendChild(app.view);
const background = PIXI.Sprite.from('https://pixijs.com/assets/bg_grass.jpg');
background.width = app.screen.width;
background.height = app.screen.height;
app.stage.addChild(background);
app.stop();
fetch('https://pixijs.com/assets/pixi-filters/shader.frag')
.then((res) => res.text())
.then(onLoaded);
let filter;
function onLoaded(data)
{
filter = new PIXI.Filter(null, data, {
customUniform: 0.0,
});
background.filters = [filter];
app.start();
}
app.ticker.add((delta) =>
{
filter.uniforms.customUniform += 0.04 * delta;
});