API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LTweenLite Class

Available since 1.4.0

LTweenLite is an extremely fast, lightweight, and flexible animation tool that serves as the foundation Animation Platform.

Constructor

LTweenLite

() public

Defined in transitions/LTweenLite.js:1

Available since 1.4.0

Item Index

Methods

LTweenLite.remove

(
  • tween
)
public static

Defined in transitions/LTweenLite.js:236

Available since 1.8.0

Static method to stop a tween affect.

Parameters:

  • tween LTweenLiteChild

    a tween affect.

Example:

LInit(1000/50,"legend",800,450,main);
var tween;
function main(){
    LGlobal.setDebug(true);
    var rect = new LSprite();
    rect.x = 50;
    rect.y = 50;
    rect.graphics.drawRect("#FF00FF",1,[0,0,20,20],true,"#FF00FF");
    addChild(rect);
    tween = LTweenLite.to(rect,1,{x:500,loop:true,ease:LEasing.Sine.easeInOut})
    .to(rect,1,{x:50,ease:LEasing.Quad.easeInOut});
    var stopButton = new LButtonSample1("stop");
    stopButton.x = 50;
    circle.y = 50;
    stopButton.y = 100;
    addChild(stopButton);
    stopButton.addEventListener(LMouseEvent.MOUSE_UP,stopTween);
}
function stopTween(e){
    LTweenLite.remove(tween);
}

LTweenLite.removeAll

() public static

Defined in transitions/LTweenLite.js:279

Available since 1.8.0

Static method to stop all the tween affects.

Example:

LInit(1000/50,"legend",800,450,main);
var tween;
function main(){
    LGlobal.setDebug(true);
    var rect = new LSprite();
    rect.x = 50;
    rect.y = 50;
    rect.graphics.drawRect("#FF00FF",1,[0,0,20,20],true,"#FF00FF");
    addChild(rect);
    tween = LTweenLite.to(rect,1,{x:500,loop:true,ease:LEasing.Sine.easeInOut})
    .to(rect,1,{x:50,ease:LEasing.Quad.easeInOut});
    var stopButton = new LButtonSample1("stop");
    stopButton.x = 50;
    circle.y = 50;
    stopButton.y = 100;
    addChild(stopButton);
    stopButton.addEventListener(LMouseEvent.MOUSE_UP,stopTween);
}
function stopTween(e){
    LTweenLite.remove(tween);
}

LTweenLite.to

(
  • target
  • duration
  • vars
)
LTweenLiteChild public static

Defined in transitions/LTweenLite.js:178

Available since 1.4.0

Static method for creating a LTweenLiteChild instance that animates to the specified destination values (from the current values).

Parameters:

  • target Object

    Target object (or array of objects) whose properties this tween affects.

  • duration Float

    Duration in seconds (or frames if useFrames:true is set in the vars parameter).

  • vars Object

    An object defining the end value for each property that should be tweened as well as any special properties like onComplete, ease, etc. For example, to tween mc.x to 100 and mc.y to 200 and then call myFunction, do this: TweenLite.to(mc, 1, {x:100, y:200, onComplete:myFunction});

    Typically the vars parameter is used to define ending values for tweening properties of the target like {x:100, y:200, alpha:0}, but the following optional special properties serve other purposes:

    PropertyTypeExplanation
    delayfloatAmount of delay in seconds (or frames for frames-based tweens) before the tween should begin.
    easeLEasingLEasing (or Function) - You can choose from various eases to control the rate of change during the animation, giving it a specific "feel". For example, LEasing.Quad.easeIn or LEasing.Cubic.easeOut. For best performance, use one of the eases. The default is LEasing.None.easeIn.
    onCompleteFunctionA function that should be called when the tween has completed
    onStartFunctionA function that should be called when the tween begins (when its time changes from 0 to some other value which can happen more than once if the tween is restarted multiple times).
    onUpdateFunctionA function that should be called every time the tween updates (on every frame while the tween is active)
    loopBooleanIf true, the tween will loop when it reaches the end. Can be set via the props param.

Returns:

LTweenLiteChild:

LTweenLiteChild instance

Example:

LInit(1000/50,"legend",800,450,main);
function main(){
    LGlobal.setDebug(true);
    var circle = new LSprite();
    circle.x = 50;
    circle.y = 50;
    circle.graphics.drawArc("#FF0000",1,[0,0,20,0,Math.PI*2],true,"#FF0000");
    addChild(circle);
    var rect = new LSprite();
    rect.x = 50;
    rect.y = 100;
    rect.graphics.drawRect("#FF00FF",1,[0,0,20,20],true,"#FF00FF");
    addChild(rect);
    LTweenLite.to(circle,2,{x:500,y:400,scaleX:3,scaleY:3,ease:LEasing.Strong.easeInOut})
    .to(circle,2,{x:700,y:50,scaleX:1,scaleY:1,ease:LEasing.Quint.easeIn,onComplete:function(e){
        trace(e.currentTarget);
        trace(e.target);
    }});
    LTweenLite.to(rect,1,{x:500,loop:true,ease:LEasing.Sine.easeInOut})
    .to(rect,1,{x:50,ease:LEasing.Quad.easeInOut});
}