Jump to content

filter - "Gray.js" or "BlurX.js" how to configure filter?


valueerror
 Share

Recommended Posts

hello fellow phaser lovers..  i'm just giving filters a shot and i need to "gray-out" some elements ..  

the first task was very easy thx to the examples on examples.phaser.io but now i wonder if it is possible to configure those filters 

 

for example it would be nice to desaturate my images but not completely..  unfortunately i can't make any sense out of the code inside gray.js

also setting the grade of the blur would be nice.. it is definitely to muche blurred right now..

 

thx in advance for any tips on how to accomplish this :)

Link to comment
Share on other sites

well..  i figured it out :)  

 

for anyone who wants to add a gray filter (desaturate) to his game... here is the how to..

 

preload:  (get gray.js from phaser git repo)

game.load.script('gray', 'Gray.js');

create:

grayfilter = game.add.filter('Gray');grayfilter.gray = 0.6;  // this sets the amount of de-saturation (1 is full)stageGroup.filters = [gray]; // apply filter to something
Link to comment
Share on other sites

the only question that remains is why do i need to import gray.js - why can't i just do something like:

 

grayfilter = new PIXI.GrayFilter();
you have to know.. i am able to use other things from here http://docs.phaser.io/PIXI.html  like new PIXI.RenderTexture or new PIXI.Matrix  so i am a little bit (or very much) confused :)
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...