Some Color Matrix Fun in Actionscript 3

I was reading Lee Brimelow’s BlogĀ  ( http://gotoandlearn.com/play?id=63 ) and was having some fun playing with effects. While I was trying out a few different solutions to see what the effect would be. The problem was having to continuously recompile my flash movie to see the changed effect. A few numeric steppers later I was able to make a this little applications that spits out the colorMatrix Filter code.

Infinite Puddle:

Have fun and share your results!

Get Adobe Flash player

But first: How Does the Color Matrix Filter work? The API Doc can be read here. But is creates a matrix that alters each pixel’s color channel.

Adobe Developer Net ColorMatrix Filter Chart

This is called an "identity matrix" and it will result in no color change.

Each channel is multiplied by the Red, Green, Blue, and Alpha channels and then offset by the last argument in each row.

Now the code I used was directly based off of Lee Brimelow’s code:

Varibles used For Color Matrix Filter and Blur Filter

Basic variables needed to create effect.

It only takes three variables to achieve this effect:

  • A Sprite Holder of what to affect
  • Blur Filter to create spill-off effect
  • Color Matrix Filter to apply for Color

And then inside an Event.ENTER_FRAME you add this code:

Draw the sprite, apply blur and color filter

Draw the sprite, apply blur and color filter

and voila cool trails! Don’t believe me? Here are some examples I was playing around with:

Lava Lamp Looping Fluid effect :

Effect creating Lava Lame Ripples

Day Glow Trails

Exploding Trails


, , , , , , , , , , , , ,

Design, Interactive  13th February 2010

About... Ben

This author published 20 posts in this site.

Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

You must be logged in to send a comment.