PIXI.js use colormatrix not for all child objects in stage

i'm using the colorMatrix Feature of PIXI.js library to randomly change the color of an image at runtime.Example: http://www.goodboydigital.com/pixijs/examples/15/ This works fine, the Problem now is that the whole stage (including a text element) gets this color matrix and changes its color all the time. I want only the image to get this effect, not the text. I tried solving this by adding another stage and adding the text element to the new stage, but it didnt work. Let me know if you need a larger code snipped to understand the Problem.

Greez


Color Matrices apply to the thing you add them to (stage, container, etc) and all of the children. If you want the matrix to only apply to a certain subset of sprites, put those sprites in a container and add the matrix to that container (as a filter) as opposed to the stage as a whole.

Side note: If it's only one sprite and the color change is simple, you may want to use the tint property in the sprite class. It's just as easy to code and takes a lot less processing power (in my experience).

链接地址: http://www.djcxy.com/p/29190.html

上一篇: Android ColorMatrix setSaturation()是否支持大于一的值?

下一篇: PIXI.js不是为阶段中的所有子对象使用colormatrix