Im trying to apply a filter to a sprite. I’m comming from PIXI, and they way i was achieving it was
this.someSprite.filters = [new OutlineFilter(9, 0xFF0000,1)]; // this is an example for OutlineFilter
I’m trying to achieve the same effect in Phaser 2. I followed the instructions in this link
https://github.com/pixijs/pixi-filters/tree/master/filters/outline , imported the outline filter but Visual Studio code underlines this part
new OutlineFilter(9, 0xFF0000,1)
and the error is
Type ‘OutlineFilter’ is missing the following properties from type ‘AbstractFilter’: dirty, padding, uniforms, fragmentSrc, and 2 more
Probably im not doing it in the right way, can anyone help with this ?
September 26, 2019, 9:05pm
The way you apply filters is exactly the same in Phaser 2, but the filter has to be compatible in the first place (which it sounds like the Outline one isn’t)
Thanks for your answer. As i know, filters can be applied to any displayObject, and in Phaser, the sprite is also displayObject ( and also it’s children are displayObjects) . I tried with GlowFilter now too, same error occurs.
How can i make it compatible ?
@rich any updates on this ?
October 4, 2019, 10:00am
The way you’ve applied it is correct, but the filter itself clearly isn’t compatible. You’ll need to recode the filter for it to work.
October 4, 2019, 3:15pm
This is the PIXI 2 version of the filter, I think: