03 June 2008

Motion Blur

O.K., last one for the day—I promise.

I just committed a small addition to net.tmkeesey. As alluded to in my last post, it's motion blur. How easy is it to use? Here:

import net.tmkeesey.anim.effects.MotionBlur;
new MotionBlur(myDisplayObject);

Done. Now myDisplayObject will blur whenever you move it. It even works with preexisting filters. (Note that the blur looks best for horizontal and vertical motion, though. I may work on an improvement for that later.) There are also a few optional parameters: blurFactor (how much to blur per pixel moved), optimized (optimization flag—only uses powers of two for blurring if set to true the default), and quality (blur quality).

In the future I'd like to update this so that the parameters can be changed on the fly, but I'm not sure how useful that would really be. Good enough for now.

Once again, the code can be checked out from:
http://svn3.cvsdude.com/keesey/PROJECTS/tmkeesey/trunk

3 comments:

  1. awesome, good work. Super easy syntax.

    ReplyDelete
  2. THANKS A LOT.
    You've just solved me a week of sleepless nights trying to make a motion blur that looks good :)

    Great work.

    ReplyDelete
  3. Any idea why on first tween movment on an mc that has the MotionBlur function on it flickers? It just disappears for a split second and then shows up again. Any tween movment after the first one works great with the blur...

    ReplyDelete