Package | com.greensock.plugins |
Class | public class MotionBlurPlugin |
Inheritance | MotionBlurPlugin TweenPlugin Object |
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 [almost] zero during the course of the tween. The original DisplayObject still follows the
course of the tween, so MouseEvents are properly dispatched. You shouldn't notice any loss of 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. You can activate fastMode
to significantly speed up rendering if the object's contents and size/color doesn't need to change during the
course of the tween.
motionBlur recognizes the following properties:
true
will significantly improve rendering
performance but it is only appropriate for situations when the target object's contents,
size, color, filters, etc. do not need to change during the course of the tween. It works
by essentially taking a BitmapData snapshot of the target object at the beginning of the
tween and then reuses that throughout the tween, blurring it appropriately. The default
value for fastMode
is false
.getDefinitionByName("mx.managers.SystemManager")
)
in which case it will use a UIComponent in order to comply with Flex requirements (if we
addChild() a Sprite, Flex throws an error saying it requires a UIComponent). Typically the
appropriate container class is automatically selected for you (Sprite or UIComponent) but there
are some extremely rare circumstances under which it may be useful to define the class yourself.
That's precisely what containerClass
is for. Example: containerClass:Sprite
You can optionally set motionBlur to the Boolean value of true
in order to use the defaults. (see below for examples)
Also note that due to a bug in Flash, if you apply motionBlur to an object that was masked in the Flash IDE it won't work
properly - you must apply the mask via ActionScript instead (and set both the mask's and the masked object's cacheAsBitmap
property to true). And another bug in Flash prevents motionBlur from working on objects that have 3D properties applied,
like z, rotationY, rotationX,
or rotationZ
.
USAGE:
import com.greensock.*; import com.greensock.plugins.*; TweenPlugin.activate([MotionBlurPlugin]); //only do this once in your SWF to activate the plugin TweenMax.to(mc, 2, {x:400, y:300, motionBlur:{strength:1.5, fastMode:true, padding:15}}); //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://www.greensock.com/club/ to sign up or get more details.
Copyright 2008-2013, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.
Method | Defined By | ||
---|---|---|---|
_kill(lookup:Object):Boolean [override] | MotionBlurPlugin | ||
activate(plugins:Array):Boolean [static]
Activates one or more plugins so that TweenLite and TweenMax recognize the associated special properties. | TweenPlugin |