MotionBlurPlugin provides an easy way to apply a directional blur to a DisplayObject based on its velocity
and angle of movement in 2D (x/y). This creates a much more realistic effect than a standard blurFilter for
several reasons:
- A regular blurFilter is limited to bluring horizontally and/or vertically whereas the motionBlur
gets applied at the angle at which the object is moving.
- A blurFilter tween has static start/end values whereas a motionBlur tween dynamically adjusts the
values on-the-fly during the tween based on the velocity of the object. So if you use a Strong.easeInOut
for example, the strength of the blur will start out low, then increase as the object moves faster, and
reduce again towards the end of the tween.
motionBlur even works on bezier/bezierThrough tweens!
To accomplish the effect, MotionBlurPlugin creates a Bitmap that it places over the original object, changing
alpha of the original to zero during the course of the tween. The original DisplayObject still follows the
course of the tween, so MouseEvents are properly triggered. You shouldn't notice any loss in interactivity.
The DisplayObject can also have animated contents - MotionBlurPlugin automatically updates on every frame.
Be aware, however, that as with most filter effects, MotionBlurPlugin is somewhat CPU-intensive, so it is not
recommended that you tween large quantities of objects simultaneously.
motionBlur recognizes the following properties:
- strength - Determines the strength of the blur. The default is 1. For a more powerful
blur, increase the number. Or reduce it to make the effect more subtle.
- quality - The lower the quality, the less CPU-intensive the effect will be. Options
are 1, 2, or 3. The default is 2.
You can optionally set motionBlur to the Boolean value of true in order to use the defaults. (see below for examples)
USAGE:
import com.greensock.TweenMax;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.MotionBlurPlugin;
TweenPlugin.activate([MotionBlurPlugin]); //only do this once in your SWF to activate the plugin
TweenMax.to(mc, 2, {x:400, y:300, motionBlur:{strength:2, quality:1}});
//or to use the default values, you can simply pass in the Boolean "true" instead:
TweenMax.to(mc, 2, {x:400, y:300, motionBlur:true});
MotionBlurPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class
without violating the terms of use. Visit http://blog.greensock.com/club/ to sign up or get more details.
Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in
http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.