tilemap icon indicating copy to clipboard operation
tilemap copied to clipboard

Pixi Filters do not animate over tilemap

Open autemox opened this issue 7 years ago • 3 comments

Hello,

Has anyone gotten pixi filters, such as the GodRayFilter https://pixijs.io/pixi-filters/docs/PIXI.filters.GodrayFilter.html to animate over a tilemap?

My filter appears but it fails to animate over the tilemap.

autemox avatar Sep 17 '18 19:09 autemox

the thing is, tilemap doesn't have bounds, and filter requires bounds. If your tilemap is fullscreen, you can just specify tilemap.filterArea = app.screen or tilemap.filterArea=renderer.screen, and it'll work just fine. Otherwise, create a rectangle with screen coords and set filterArea to it.

I'm sorry I didnt see your issue, next time bump it to get my attention if i dont answer in a week

ivanpopelyshev avatar Feb 10 '19 22:02 ivanpopelyshev

Does not seem like either tilemap.filterArea = app.screen, nor tilemap.filterArea = new Rectangle(0, 0, 99999, 99999) work, not with AlphaFilter or BlurFilter at least.

pixiTilemap.filterArea = new Rectangle(0, 0, 99999, 99999);
pixiTilemap.filters = [
    new AlphaFilter(0.5),
];

These lines seem to affect nothing.

klesun avatar May 30 '23 19:05 klesun

Oh, though filters do work if you wrap tilemap in a parent container and apply filters on that parent container rather than on tilemap itself.

import { Container, AlphaFilter } from "pixi.js";

const cont = new Container();
app.stage.addChild(cont);
cont.filters = [
    new AlphaFilter(layer.opacity)
];
cont.addChild(pixiTilemap);

image

klesun avatar May 30 '23 19:05 klesun