I’ve finally found some time to clean up my MotionBlurSprite source and make it interchangeable with Flash’s Sprite class.
- Almost completely interchangeable with Sprite class (see caveats).
- Ability to specify blur by angle & distance, or by vector (dx, dy) – the latter is perfect for blurring based on the sprite’s velocity.
- Transforms (rotate, scale etc) affect the filtered sprite, unlike normal Flash filters which are applied after transforms.
- No mouse interaction with children, although I’m planning to add child mouse interaction in future.
- Sprite size is limited to Flash’s maximum bitmap size of 2880×2880.
- Need to call blur(), blur2() or update() after changes to graphics or children. It’s best just to call the relevent blur() method on enterFrame after all other updates have been made.
I’d love to know if you use this class in your project – please let me know.
Here’s a basic demo of the class with angle and distance controls and the ability to add/remove children and draw to graphics on-the-fly. The standard Flash Sprite is on the left and MotionBlurSprite is on the right. The method calls to add/remove children and draw graphics on both are identical. Thanks to Keith Peters for his awesome little MinimalComps UI components – very handy for things like this.