Phaser v2 using pixi filters ( OutlineFilter)

Hello everyone!

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 ?

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)

1 Like

Hey @rich!
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 ?

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.

This is the PIXI 2 version of the filter, I think:

https://codepen.io/samme/pen/VwZOwxR