Jump to content

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


Go to solution Solved by valueerror,

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 post
Share on other sites
  • Solution

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...