import * as PIXI from 'pixi.js';
const app = new PIXI.Application({ resizeTo: window });
document.body.appendChild(app.view);
app.stage.eventMode = 'static';
const container = new PIXI.Container();
app.stage.addChild(container);
const flag = PIXI.Sprite.from('https://pixijs.com/assets/pixi-filters/flag.png');
container.addChild(flag);
flag.x = 100;
flag.y = 100;
const displacementSprite = PIXI.Sprite.from('https://pixijs.com/assets/pixi-filters/displacement_map_repeat.jpg');
displacementSprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
const displacementFilter = new PIXI.filters.DisplacementFilter(displacementSprite);
displacementFilter.padding = 10;
displacementSprite.position = flag.position;
app.stage.addChild(displacementSprite);
flag.filters = [displacementFilter];
displacementFilter.scale.x = 30;
displacementFilter.scale.y = 60;
app.ticker.add(() =>
{
displacementSprite.x++;
if (displacementSprite.x > displacementSprite.width) { displacementSprite.x = 0; }
});