/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
TweenMax.to(event.target.txt, .4, {tint:0xFF0000, ease:Expo.EaseInOut, onComplete:myFunctionNam}); ARGUMENTS: 1) $target : Object - Target MovieClip (or any other object) whose properties we're tweening 2) $duration : Number - Duration (in seconds) of the effect 3) $vars : Object - An object containing the end values of all the properties you'd like to have tweened (or if you're using the TweenLite.from() method, these variables would define the BEGINNING values). For example: alpha: The alpha (opacity level) that the target object should finish at (or begin at if you're using TweenLite.from()). For example, if the target.alpha is 1 when this script is called, and you specify this argument to be 0.5, it'll transition from 1 to 0.5. x: To change a MovieClip's x position, just set this to the value you'd like the MovieClip to end up at (or begin at if you're using TweenLite.from()). SPECIAL PROPERTIES (**OPTIONAL**): delay : Number - Amount of delay before the tween should begin (in seconds). ease : Function - You can specify a function to use for the easing with this variable. For example, gs.easing.Elastic.easeOut. The Default is Regular.easeOut. easeParams : Array - An array of extra parameters to feed the easing equation. This can be useful when you use an equation like Elastic and want to control extra parameters like the amplitude and period. Most easing equations, however, don't require extra parameters so you won't need to pass in any easeParams. autoAlpha : Number - Use it instead of the alpha property to gain the additional feature of toggling the visible property to false when alpha reaches 0. It will also toggle visible to true before the tween starts if the value of autoAlpha is greater than zero. visible : Boolean - To set a DisplayObject's "visible" property at the end of the tween, use this special property. volume : Number - Tweens the volume of an object with a soundTransform property (MovieClip/SoundChannel/NetStream, etc.) tint : Number - To change a DisplayObject's tint/color, set this to the hex value of the tint you'd like to end up at(or begin at if you're using TweenLite.from()). An example hex value would be 0xFF0000. removeTint : Boolean - If you'd like to remove the tint that's applied to a DisplayObject, pass true for this special property. frame : Number - Use this to tween a MovieClip to a particular frame. onStart : Function - If you'd like to call a function as soon as the tween begins, pass in a reference to it here. This is useful for when there's a delay. onStartParams : Array - An array of parameters to pass the onStart function. (this is optional) onUpdate : Function - If you'd like to call a function every time the property values are updated (on every frame during the time the tween is active), pass a reference to it here. onUpdateParams : Array - An array of parameters to pass the onUpdate function (this is optional) onComplete : Function - If you'd like to call a function when the tween has finished, use this. onCompleteParams : Array - An array of parameters to pass the onComplete function (this is optional) persist : Boolean - if true, the TweenLite instance will NOT automatically be removed by the garbage collector when it is complete. However, it is still eligible to be overwritten by new tweens even if persist is true. By default, it is false. renderOnStart : Boolean - If you're using TweenFilterLite.from() with a delay and want to prevent the tween from rendering until it actually begins, set this to true. By default, it's false which causes TweenLite.from() to render its values immediately, even before the delay has expired. overwrite : int - Controls how other tweens of the same object are handled when this tween is created. Here are the options: - 0 (NONE): No tweens are overwritten. This is the fastest mode, but you need to be careful not to create any tweens with overlapping properties, otherwise they'll conflict with each other. - 1 (ALL): (this is the default unless OverwriteManager.init() has been called) All tweens of the same object are completely overwritten immediately when the tween is created. TweenLite.to(mc, 1, {x:100, y:200}); TweenLite.to(mc, 1, {x:300, delay:2, overwrite:1}); //immediately overwrites the previous tween - 2 (AUTO): (used by default if OverwriteManager.init() has been called) Searches for and overwrites only individual overlapping properties in tweens that are active when the tween begins. TweenLite.to(mc, 1, {x:100, y:200}); TweenLite.to(mc, 1, {x:300, overwrite:2}); //only overwrites the "x" property in the previous tween - 3 (CONCURRENT): Overwrites all tweens of the same object that are active when the tween begins. TweenLite.to(mc, 1, {x:100, y:200}); TweenLite.to(mc, 1, {x:300, delay:2, overwrite:3}); //does NOT overwrite the previous tween because the first tween will have finished by the time this one begins.