Tweenlite parameter description

Source: Internet
Author: User

Tweenlite parameter description:
 
1) $ target: Object-as the target object, movieclip or other objects
 
2) $ duration: Number-animation duration (unit: seconds)
 
3) $ vars: object. attribute values are used to store various attribute parameters for easing. (If you use the tweenlite. From () method, the parameter here indicates the initial value of easing)
 

Attributes of the object:
 
ALPHA: the alpha target object should be completed (or started when tweenlite is used. from () Transparency Level. if target. alpha is 1. When the easing is executed, you specify the parameter as 0.5, which will slow the transparency from 1 to 0.5.
 
X: change the position of movieclip X and set this value to the end position of your desired movieclip (if you are using tweenlite. From (), this value indicates the start position ).
 
(Attributes such as y scalex scaley rotation are not repeated)
 
Special attributes (** optional **):
 
Delay: Number-delay (in seconds ).
 
Slow: function-easing function. For example, Fl. Motion. Easing. elastic. easeout function. The default value is the regular. easeout function.
 
Easeparams: array-additional data required to store the easing formula. When elastic formula is used and you want to control additional parameters, such as the amplification factor and easing time. Most slow formulas do not require parameters. Therefore, you do not need to pass parameters to other slow formulas.
 
Autoalpha: Number-use it to replace the Alpha attribute to obtain some sub-addition effects. For example, when the Alpha value is slowed down to 0, the visible attribute is automatically changed to false. When autoalpha is greater than 0 before the easing starts, it will change the visible attribute to true.
 
Visible: Boolean-this parameter is used to specify the visible attribute of displayobject at the end of easing.
 
Volume: Number-easing the volume attribute (volume size) in the soundtransform (movieclip/soundchannel/netstream, etc.) object
 
Tint: Number-change the color of displayobject. After a hexadecimal color value is set, the target object will be changed to this color when the easing ends (if tweenlite is used. from (), which indicates the color of the target object when it starts to slow down ). For example, the color value can be set to 0xff0000.
 
Removetint: Boolean-to remove the displayobject color, set this parameter to true.
 
Frame: Number-slow movieclip to the specified frame rate.
 
Onstart: function-if you want to execute a function at the beginning of the easing, place the function reference (usually the function name) here. If the easing operation has a delay, the function will not be executed before the easing operation starts.
 
Onstartparams: array-this is the function parameter to be executed when the easing starts. (Optional)
 
Onupdate: During the function-easing process, the function specified here is called each time a new update is made (each frame is triggered once after the easing starts ),
 
Onupdateparams: array-pass parameters to the function specified by the onupdate parameter (optional)
 
Oncomplete: The function executed at the end of the function-easing.
 
Oncompleteparams: array-pass parameters to the function specified by the oncomplete parameter (optional)
 
If the persist: Boolean-value is true, the tweenlite instance will not be automatically collected by the system's garbage collector. However, when a new easing occurs, it will still be overwritten (overwritten). The default value is false.
 
Renderonstart: Boolean-if you use tweenfilterlite with delayed delay. from (), and stop the rendering effect until the animation really starts, set this value to true. by default, this value is false, which causes the rendering effect to be executed immediately, even before the delay.
 
Overwrite: int-after the current easing is created, this parameter can be used to restrict other easing actions on the same object. optional parameter values include:
 
-0 (none): no easing is overwritten. In this mode, the operation speed is the fastest, but you need to avoid creating some slow actions that control the same attributes. Otherwise, these slow actions may conflict.
 
-1 (all): (this is the default value, unless overwritemanager. INIT () has been called) All the easing actions on the same object will be completely overwritten during creation.
 
Tweenlite. To (MC, 1, {X: 100, Y: 200 });
 
Tweenlite. to (MC, 1, {X: 300, delay: 2}); // The created easing will overwrite the previously created easing, (it can play the role of being interrupted when the slow-moving process is halfway through, and executing a new slow-moving Translator's note)
 
-2 (automatic): (when overwritemanager. INIT () is executed, it will be selected based on the specific attribute value) only covers the easing of the same attribute.
 
Tweenlite. To (MC, 1, {X: 100, Y: 200 });
 
Tweenlite. To (MC, 1, {X: 300}); // the easing of the only "X" attribute will be overwritten.
 
-3 (occurring at the same time): cover all the easing operations when the easing starts.
 
Tweenlite. To (MC, 1, {X: 100, Y: 200 });
 
Tweenlite. to (MC, 1, {X: 300, delay: 2}); // It does not overwrite the previous easing because every two easing starts, the first easing is over.
 

Example:
 
Set the movieclip transparency of the Instance named "clip_mc" to 50% (0.5), move it to 120 on the X axis, and set the volume to 0. It takes 1.5 seconds for the instance to be slowed down. The Code is as follows:
 
Import Gs. tweenlite;
 
Tweenlite. To (clip_mc, 1.5, {ALPHA: 0.5, X: 120, volume: 0 });
 

If you want to use a more advanced easing function within 5, change Alpha to 0.5, move X to 120, and use the "easeoutback" function to slow down the overall Latency by 2 seconds, at the end of the easing, execute the "onfinishtween" function and pass several parameters to the function (a value of 5 and a reference to clip_mc). The Code is as follows:
 
Import Gs. tweenlite;
 
Import Fl. Motion. Easing. back;
 
Tweenlite. to (clip_mc, 5, {ALPHA: 0.5, X: 120, round: back. easeout, delay: 2, oncomplete: onfinishtween, oncompleteparams: [5, clip_mc]});
 
Function onfinishtween (argument1: Number, argument2: movieclip): void {
 
Trace ("the Tween has finished! Argument1 = "+ argument1 +", and argument2 = "+ argument2 );
 
}
 

If the movieclip on your stage has been stopped at its end position, you just want it to take 5 seconds to return to this position (you only need to change the y attribute, the Code is as follows (this time uses tweenlite. from Translator's note ):
 
Import Gs. tweenlite;
 
Import Fl. Motion. Easing. Elastic;
 
Tweenlite. From (clip_mc, 5, {y: "-100", role: elastic. easeout });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.