Question

At the moment my game looks something like this: http://i.imgur.com/pwzUO.jpg

I want to change the hue of background squares so that each level would have different color. I did some research and figured out that I could use ColorMatrixFilter for this. I managed to get code like this to work, which changes the hue:

var matrix:Array = new Array();
        matrix = matrix.concat([1, 1, 1, 0, 0]); // red
            matrix = matrix.concat([0, 1, 0, 0, 0]); // green
            matrix = matrix.concat([0, 0, 1, 1, 0]); // blue
            matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha

           back.applyFilter(koe, new Rectangle(0, 0, 640, 480), new Point(0, 0), new ColorMatrixFilter(matrix));

However, what I didn't figure out was how exactly the matrix works and how I could get hue value from Photoshop for example and insert it to the matrix, or tween hue from -180 to 180. Like for example, in Photoshop, I can use slider to set "Hue" to to +87 to get desired color.

So how exactly I can insert the Hue value which Photoshop or other image software gives me to this matrix?

Was it helpful?

Solution

You can use ColorMatrix utility class by Grant Skinner the adjustHue method

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top