- Developed by Dented Pixel
API Docs for: LeanTween 2.50

Support LeanTween!

Maintaining and adding new features takes time, your support is appreciated.

Show:

LeanTween Class

Defined in: LeanTween.cs:223

LeanTween is an efficient tweening engine for Unity3d

Index of All Methods | Optional Paramaters that can be passed

Optional Parameters are passed at the end of every method

Example:
LeanTween.moveX( gameObject, 1f, 1f).setEase( LeanTweenType.easeInQuad ).setDelay(1f);

You can pass the optional parameters in any order, and chain on as many as you wish!

You can also modify this tween later, just save the unique id of the tween.

Example:

int id = LeanTween.moveX(gameObject, 1f, 1f).id;
LTDescr d = LeanTween.descr( id );

if(d!=null){ // if the tween has already finished it will return null
   // change some parameters
   d.setOnComplete( onCompleteFunc ).setEase( LeanTweenType.easeInOutBack );
}

Item Index

Methods

Methods

LeanTween.addListener

(
  • caller:GameObject
  • eventId:int
  • callback:System.Action<LTEvent>
)

Defined in LeanTween.cs:2743

Add a listener method to be called when the appropriate LeanTween.dispatchEvent is called

Parameters:

  • caller:GameObject GameObject

    the gameObject the listener is attached to

  • eventId:int Int

    a unique int that describes the event (best to use an enum)

  • callback:System.Action<LTEvent> System.Action

    the method to call when the event has been dispatched

Example:

LeanTween.addListener(gameObject, (int)MyEvents.JUMP, jumpUp);

void jumpUp( LTEvent e ){ Debug.Log("jump!"); }

LeanTween.alpha

(
  • gameObject:GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1090

Fade a gameobject's material to a certain alpha value.

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to fade

  • to:float Float

    the final alpha value (0-1)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.alpha(gameObject, 1f, 1f) .setDelay(1f);

LeanTween.alpha

(
  • ltRect:LTRect
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1111

Fade a GUI Object

Parameters:

  • ltRect:LTRect LTRect

    LTRect that you wish to fade

  • to:float Float

    the final alpha value (0-1)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.alpha(ltRect, 1f, 1f) .setEase(LeanTweenType.easeInCirc);

LeanTween.alpha (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:2089

Alpha an Image Component attached to a RectTransform (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The final Vector3 with which to tween to (localScale)

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.alpha(gameObject.GetComponent<RectTransform>(), 0.5f, 1f).setDelay(1f);

LeanTween.alpha (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:2103

Change the Color of an Image Component attached to a RectTransform (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The final Vector3 with which to tween to (localScale)

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.color(gameObject.GetComponent<RectTransform>(), 0.5f, 1f).setDelay(1f);

LeanTween.alphaCanvas

(
  • rectTransform:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1147

Fade a Unity UI Canvas Group

Parameters:

  • rectTransform:RectTransform RectTransform

    RectTransform that the CanvasGroup is attached to

  • to:float Float

    the final alpha value (0-1)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.alphaCanvas(gameObject.GetComponent<RectTransform>(), 0f, 1f) .setLoopPingPong();

LeanTween.alphaText

(
  • rectTransform:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1129

Fade a Unity UI Object

Parameters:

  • rectTransform:RectTransform RectTransform

    RectTransform associated with the Text Component you wish to fade

  • to:float Float

    the final alpha value (0-1)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.alphaText(gameObject.GetComponent<RectTransform>(), 1f, 1f) .setEase(LeanTweenType.easeInCirc);

LeanTween.alphaVertex

(
  • gameObject:GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1163

This works by tweening the vertex colors directly
Vertex-based coloring is useful because you avoid making a copy of your object's material for each instance that needs a different color.

A shader that supports vertex colors is required for it to work (for example the shaders in Mobile/Particles/)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to alpha

  • to:float Float

    The alpha value you wish to tween to

  • time:float Float

    The time with which to delay before calling the function

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.cancel

(
  • id:int
  • callOnComplete:bool
)

Defined in LeanTween.cs:588

Cancel a specific tween with the provided id

Parameters:

  • id:int Int

    unique id that represents that tween

  • callOnComplete:bool Bool

    (optional) whether to call the onComplete method before canceling

Example:

int id = LeanTween.move( gameObject, new Vector3(0f,1f,2f), 1f).id;
LeanTween.cancel( id );

LeanTween.cancel

(
  • gameObject:GameObject
  • callOnComplete:bool
)

Defined in LeanTween.cs:523

Cancel all tweens that are currently targeting the gameObject

Parameters:

  • gameObject:GameObject GameObject

    gameObject whose tweens you wish to cancel

  • callOnComplete:bool Bool

    (optional) whether to call the onComplete method before canceling

Example:

LeanTween.move( gameObject, new Vector3(0f,1f,2f), 1f);
LeanTween.cancel( gameObject );

LeanTween.cancelAll

(
  • callComplete:bool
)

Defined in LeanTween.cs:501

Cancels all tweens

Parameters:

  • callComplete:bool Bool

    (optional) if true, then the all onCompletes will run before canceling

Example:

LeanTween.cancelAll(true);

LeanTween.color

(
  • gameObject:GameObject
  • to:Color
  • time:float
)
LTDescr

Defined in LeanTween.cs:1182

Change a gameobject's material to a certain color value

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to change the color

  • to:Color Color

    the final color value ex: Color.Red, new Color(1.0f,1.0f,0.0f,0.8f)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.color(gameObject, Color.yellow, 1f) .setDelay(1f);

LeanTween.colorText

(
  • rectTransform:RectTransform
  • to:Color
  • time:float
)
LTDescr

Defined in LeanTween.cs:1203

Change the color a Unity UI Object

Parameters:

  • rectTransform:RectTransform RectTransform

    RectTransform attached to the Text Component whose color you want to change

  • to:Color Color

    the final alpha value ex: Color.Red, new Color(1.0f,1.0f,0.0f,0.8f)

  • time:float Float

    The time with which to fade the object

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.colorText(gameObject.GetComponent<RectTransform>(), Color.yellow, 1f) .setDelay(1f);

LeanTween.delayedCall

(
  • gameObject:GameObject
  • time:float
)
LTDescr

Defined in LeanTween.cs:1222

Call a method after a specified amount of time

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to associate with this delayed call

  • time:float Float

    delay The time you wish to pass before the method is called

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.delayedCall(gameObject, 1f, ()=>{
Debug.Log("I am called one second later!");
}));

LeanTween.descr

(
  • id:int
)

Defined in LeanTween.cs:631

Retrieve a tweens LTDescr object to modify

Parameters:

  • id:int Int

    unique id that represents that tween

Example:

int id = LeanTween.move( gameObject, new Vector3(0f,1f,2f), 1f).setOnComplete( oldMethod ).id;

// later I want decide I want to change onComplete method
LTDescr descr = LeanTween.descr( id );
if(descr!=null) // if the tween has already finished it will come back null
  descr.setOnComplete( newMethod );

LeanTween.descriptions

(
  • id:GameObject
)

Defined in LeanTween.cs:665

Retrieve a tweens LTDescr object(s) to modify

Parameters:

  • id:GameObject GameObject

    object whose tween descriptions you want to retrieve

Example:

LeanTween.move( gameObject, new Vector3(0f,1f,2f), 1f).setOnComplete( oldMethod );

// later I want decide I want to change onComplete method
LTDescr[] descr = LeanTween.descriptions( gameObject );
if(descr.Length>0) // make sure there is a valid description for this target
  descr[0].setOnComplete( newMethod );// in this case we only ever expect there to be one tween on this object

LeanTween.dispatchEvent

(
  • eventId:int
  • data:object
)

Defined in LeanTween.cs:2838

Tell the added listeners that you are dispatching the event

Parameters:

  • eventId:int Int

    a unique int that describes the event (best to use an enum)

  • data:object Object

    Pass data to the listener, access it from the listener with *.data on the LTEvent object

Example:

LeanTween.dispatchEvent( (int)MyEvents.JUMP, transform );

void jumpUp( LTEvent e ){
  Transform tran = (Transform)e.data;
}

LeanTween.dispatchEvent

(
  • eventId:int
)

Defined in LeanTween.cs:2827

Tell the added listeners that you are dispatching the event

Parameters:

  • eventId:int Int

    a unique int that describes the event (best to use an enum)

Example:

LeanTween.dispatchEvent( (int)MyEvents.JUMP );

LeanTween.followBounceOut

(
  • transform:Transform
  • transform:Transform
  • leanProp:LeanProp
  • smoothTime:float
  • [maxSpeed]
  • [friction]
  • [accelRate]
  • [hitDamp]
)

Defined in LeanTween.cs:2597

Follow another transforms position/scale/color (with an ease that bounces back some when it reaches it's destination)

Parameters:

  • transform:Transform Transform

    the transform you wish to be the follower

  • transform:Transform Transform

    the transform you wish to follow

  • leanProp:LeanProp LeanProp

    enum of the type of following you wish to do position, scale, color, etc.

  • smoothTime:float Float

    roughly the time it takes to reach the destination

  • [maxSpeed] Float optional

    :float maximum speed at which it moves towards the destination

  • [friction] Float optional

    :float rate at which the spring is slowed down once it reaches it's destination

  • [accelRate] Float optional

    :float the rate it accelerates from it's initial position

  • [hitDamp] Float optional

    :float the rate at which to dampen the bounciness of when it reaches it's destination

Example:

LeanTween.followBounceOut(transform, followTransform, LeanProp.localY, 1.1f);

LeanTween.followDamp

(
  • transform:Transform
  • transform:Transform
  • leanProp:LeanProp
  • smoothTime:float
  • [maxSpeed]
)

Defined in LeanTween.cs:2461

Follow another transforms position/scale/color with a damp transition (eases in and out to destination with no overshoot)

Parameters:

  • transform:Transform Transform

    the transform you wish to be the follower

  • transform:Transform Transform

    the transform you wish to follow

  • leanProp:LeanProp LeanProp

    enum of the type of following you wish to do position, scale, color, etc.

  • smoothTime:float Float

    roughly the time it takes to reach the destination

  • [maxSpeed] Float optional

    :float maximum speed at which it moves towards the destination

Example:

LeanTween.followDamp(transform, followTransform, LeanProp.localY, 1.1f);

LeanTween.followLinear

(
  • transform:Transform
  • transform:Transform
  • leanProp:LeanProp
  • moveSpeed:float
)

Defined in LeanTween.cs:2666

Follow another transforms position/scale/color with a constant speed

Parameters:

  • transform:Transform Transform

    the transform you wish to be the follower

  • transform:Transform Transform

    the transform you wish to follow

  • leanProp:LeanProp LeanProp

    enum of the type of following you wish to do position, scale, color, etc.

  • moveSpeed:float Float

    roughly the time it takes to reach the destination

Example:

LeanTween.followLinear(transform, followTransform, LeanProp.localY, 50f);

LeanTween.followSpring

(
  • transform:Transform
  • transform:Transform
  • leanProp:LeanProp
  • smoothTime:float
  • [maxSpeed]
  • [friction]
  • [accelRate]
)

Defined in LeanTween.cs:2528

Follow another transforms position/scale/color with a springy transition (eases in and out to destination with possible overshoot bounciness)

Parameters:

  • transform:Transform Transform

    the transform you wish to be the follower

  • transform:Transform Transform

    the transform you wish to follow

  • leanProp:LeanProp LeanProp

    enum of the type of following you wish to do position, scale, color, etc.

  • smoothTime:float Float

    roughly the time it takes to reach the destination

  • [maxSpeed] Float optional

    :float maximum speed at which it moves towards the destination

  • [friction] Float optional

    :float rate at which the spring is slowed down once it reaches it's destination

  • [accelRate] Float optional

    :float the rate it accelerates from it's initial position

Example:

LeanTween.followSpring(transform, followTransform, LeanProp.localY);

LeanTween.init

(
  • maxSimultaneousTweens:int
)

Defined in LeanTween.cs:309

This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400). This must be called before any use of LeanTween is made for it to be effective.

This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400). This must be called before any use of LeanTween is made for it to be effective.

Parameters:

  • maxSimultaneousTweens:int Integer

    The maximum number of tweens you will use, make sure you don't go over this limit, otherwise the code will throw an error

Example:

LeanTween.init( 800 );

LeanTween.isPaused

(
  • gameObject:GameObject
)

Defined in LeanTween.cs:789

Test whether or not a tween is paused on a GameObject

Parameters:

  • gameObject:GameObject GameObject

    GameObject that you want to test if it is paused

LeanTween.isPaused

(
  • id:int
)

Defined in LeanTween.cs:820

Test whether or not a tween is paused or not

Parameters:

  • id:int GameObject

    id of the tween that you want to test if it is paused

Example:

int id = LeanTween.moveX(gameObject, 1f, 3f).id;
LeanTween.pause(gameObject);
if(LeanTween.isPaused( id ))
     Debug.Log("I am paused!");

LeanTween.isTweening

(
  • gameObject:GameObject
)

Defined in LeanTween.cs:844

Test whether or not a tween is active on a GameObject

Parameters:

  • gameObject:GameObject GameObject

    GameObject that you want to test if it is tweening

LeanTween.isTweening

(
  • id:int
)

Defined in LeanTween.cs:870

Test whether or not a tween is active or not

Parameters:

  • id:int GameObject

    id of the tween that you want to test if it is tweening

Example:

int id = LeanTween.moveX(gameObject, 1f, 3f).id;
if(LeanTween.isTweening( id ))
     Debug.Log("I am tweening!");

LeanTween.move

(
  • gameObject:GameObject
  • destination:Transform
  • time:float
)
LTDescr

Defined in LeanTween.cs:1493

Move a GameObject to another transform

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • destination:Transform Transform

    Transform whose position the tween will finally end on

  • time:float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.move(gameObject, anotherTransform, 2.0f) .setEase( LeanTweenType.easeOutQuad );

LeanTween.move

(
  • gameObject:GameObject
  • path:Vector3[]
  • time:float
)
LTDescr

Defined in LeanTween.cs:1274

Move a GameObject along a set of bezier curves

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • path:Vector3[] Vector3

    A set of points that define the curve(s) ex: Point1,Handle2,Handle1,Point2,...

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Javascript:
LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

C#:
LeanTween.move(gameObject, new Vector3[]{new Vector3(0f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);;

LeanTween.move

(
  • gameObject:GameObject
  • vec:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1256

Move a GameObject to a certain location

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • vec:Vector3 Vector3

    to The final positin with which to move to

  • time:float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.move(gameObject, new Vector3(0f,-3f,5f), 2.0f) .setEase( LeanTweenType.easeOutQuad );

LeanTween.move (GUI)

(
  • ltRect:LTRect
  • vec:Vector2
  • time:float
)
LTDescr

Defined in LeanTween.cs:1375

Move a GUI Element to a certain location

Parameters:

  • ltRect:LTRect LTRect

    ltRect LTRect object that you wish to move

  • vec:Vector2 Vector2

    to The final position with which to move to (pixel coordinates)

  • time:float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.move (RectTransform)

(
  • rectTrans:RectTransform
  • to:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1957

Move a RectTransform object (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:Vector3 Vector3

    The final Vector3 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.move(gameObject.GetComponent<RectTransform>(), new Vector3(200f,-100f,0f), 1f).setDelay(1f);

LeanTween.moveLocal

(
  • GameObject
  • Vector3
  • float
)
LTDescr

Defined in LeanTween.cs:1431

Move a GameObject to a certain location relative to the parent transform.

Parameters:

  • GameObject GameObject

    gameObject Gameobject that you wish to rotate

  • Vector3 Vector3

    to The final positin with which to move to

  • float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveLocal

(
  • gameObject:GameObject
  • path:Vector3[]
  • time:float
)
LTDescr

Defined in LeanTween.cs:1444

Move a GameObject along a set of bezier curves, in local space

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • path:Vector3[] Vector3

    A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,...

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Javascript:
LeanTween.moveLocal(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

C#:
LeanTween.moveLocal(gameObject, new Vector3[]{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

LeanTween.moveSpline

(
  • gameObject:GameObject
  • spline:LTSpline
  • time:float
)
LTDescr

Defined in LeanTween.cs:1333

Move a GameObject through a set of points

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • spline:LTSpline LTSpline

    pass a pre-existing LTSpline for the object to move along

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Javascript:
LeanTween.moveSpline(gameObject, ltSpline, 2.0) .setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

C#:
LeanTween.moveSpline(gameObject, ltSpline, 1.5f).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

LeanTween.moveSpline

(
  • gameObject:GameObject
  • path:Vector3[]
  • time:float
)
LTDescr

Defined in LeanTween.cs:1312

Move a GameObject through a set of points

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • path:Vector3[] Vector3

    A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd
    Note: The first and last item just define the angle of the end points, they are not actually used in the spline path itself. If you do not care about the angle you can jus set the first two items and last two items as the same value.

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Javascript:
LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

C#:
LeanTween.moveSpline(gameObject, new Vector3[]{new Vector3(0f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

LeanTween.moveSplineLocal

(
  • gameObject:GameObject
  • path:Vector3[]
  • time:float
)
LTDescr

Defined in LeanTween.cs:1354

Move a GameObject through a set of points, in local space

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to move

  • path:Vector3[] Vector3

    A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Javascript:
LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

C#:
LeanTween.moveSpline(gameObject, new Vector3[]{new Vector3(0f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);

LeanTween.moveX

(
  • gameObject:GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1392

Move a GameObject along the x-axis

Parameters:

  • gameObject:GameObject GameObject

    gameObject Gameobject that you wish to move

  • to:float Float

    to The final position with which to move to

  • time:float Float

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveX (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1971

Move a RectTransform object affecting x-axis only (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The final x location with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.moveX(gameObject.GetComponent<RectTransform>(), 200f, 1f).setDelay(1f);

LeanTween.moveY

(
  • GameObject
  • float
  • float
)
LTDescr

Defined in LeanTween.cs:1405

Move a GameObject along the y-axis

Parameters:

  • GameObject GameObject

    gameObject Gameobject that you wish to move

  • float Float

    to The final position with which to move to

  • float Float

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveY (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1985

Move a RectTransform object affecting y-axis only (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The final y location with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.moveY(gameObject.GetComponent<RectTransform>(), 200f, 1f).setDelay(1f);

LeanTween.moveZ

(
  • GameObject
  • float
  • float
)
LTDescr

Defined in LeanTween.cs:1418

Move a GameObject along the z-axis

Parameters:

  • GameObject GameObject

    gameObject Gameobject that you wish to move

  • float Float

    to The final position with which to move to

  • float Float

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveZ (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1999

Move a RectTransform object affecting z-axis only (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)n

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The final x location with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.moveZ(gameObject.GetComponent<RectTransform>(), 200f, 1f).setDelay(1f);

LeanTween.pause

(
  • gameObject:GameObject
)

Defined in LeanTween.cs:712

Pause all tweens for a GameObject

Parameters:

  • gameObject:GameObject GameObject

    GameObject whose tweens you want to pause

LeanTween.pause

(
  • id:int
)

Defined in LeanTween.cs:693

Pause all tweens for a GameObject

Parameters:

  • id:int Int

    Id of the tween you want to pause

Example:

int id = LeanTween.moveX(gameObject, 5, 1.0).id
LeanTween.pause( id );
// Later....
LeanTween.resume( id );

LeanTween.pauseAll

()

Defined in LeanTween.cs:727

Pause all active tweens

LeanTween.play

(
  • rectTransform:RectTransform
  • sprites:Sprite[]
)
LTDescr

Defined in LeanTween.cs:1023

Play a sequence of images on a Unity UI Object

Parameters:

  • rectTransform:RectTransform RectTransform

    RectTransform that you want to play the sequence of sprites on

  • sprites:Sprite[] Sprite

    Sequence of sprites to be played

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.play(gameObject.GetComponent<RectTransform>(), sprites).setLoopPingPong();

LeanTween.removeListener

(
  • caller:GameObject
  • eventId:int
  • callback:System.Action<LTEvent>
)

Defined in LeanTween.cs:2800

Remove an event listener you have added

Parameters:

  • caller:GameObject GameObject

    the gameObject the listener is attached to

  • eventId:int Int

    a unique int that describes the event (best to use an enum)

  • callback:System.Action<LTEvent> System.Action

    the method that was specified to call when the event has been dispatched

Example:

LeanTween.removeListener(gameObject, (int)MyEvents.JUMP, jumpUp);

void jumpUp( LTEvent e ){ }

LeanTween.resume

(
  • id:int
)

Defined in LeanTween.cs:756

Resume a specific tween

Parameters:

  • id:int Int

    Id of the tween you want to resume

Example:

int id = LeanTween.moveX(gameObject, 5, 1.0).id
LeanTween.pause( id );
// Later....
LeanTween.resume( id );

LeanTween.resume

(
  • gameObject:GameObject
)

Defined in LeanTween.cs:775

Resume all the tweens on a GameObject

Parameters:

  • gameObject:GameObject GameObject

    GameObject whose tweens you want to resume

LeanTween.resumeAll

()

Defined in LeanTween.cs:739

Resume all active tweens

LeanTween.rotate

(
  • GameObject
  • Vector3
  • float
)
LTDescr

Defined in LeanTween.cs:1507

Rotate a GameObject, to values are in passed in degrees

Parameters:

  • GameObject GameObject

    gameObject Gameobject that you wish to rotate

  • Vector3 Vector3

    to The final rotation with which to rotate to

  • float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.rotate(cube, new Vector3(180f,30f,0f), 1.5f);

LeanTween.rotate

(
  • ltRect:LTRect
  • to:float
  • time:float
  • optional:Array
)
LTDescr

Defined in LeanTween.cs:1522

Rotate a GUI element (using an LTRect object), to a value that is in degrees

Parameters:

  • ltRect:LTRect LTRect

    LTRect that you wish to rotate

  • to:float Float

    The final rotation with which to rotate to

  • time:float Float

    The time to complete the tween in

  • optional:Array Array

    Object Array where you can pass optional items.

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

if(GUI.Button(buttonRect.rect, "Rotate"))
LeanTween.rotate( buttonRect4, 150.0f, 1.0f).setEase(LeanTweenType.easeOutElastic);
GUI.matrix = Matrix4x4.identity;

LeanTween.rotate (RectTransform)

(
  • rectTrans:RectTransform
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:2013

Rotate a RectTransform object (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:float Float

    The degree with which to rotate the RectTransform

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.rotate(gameObject.GetComponent<RectTransform>(), 90f, 1f).setDelay(1f);

LeanTween.rotateAround

(
  • gameObject:GameObject
  • vec:Vector3
  • degrees:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1592

Rotate a GameObject around a certain Axis (the best method to use when you want to rotate beyond 180 degrees)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to rotate

  • vec:Vector3 Vector3

    axis in which to rotate around ex: Vector3.up

  • degrees:float Float

    the degrees in which to rotate

  • time:float Float

    time The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example:
LeanTween.rotateAround ( gameObject, Vector3.left, 90f, 1f );

LeanTween.rotateAround (RectTransform)

(
  • rectTrans:RectTransform
  • axis:Vector3
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:2031

Rotate a RectTransform object (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • axis:Vector3 Vector3

    The axis in which to rotate the RectTransform (Vector3.forward is most commonly used)

  • to:float Float

    The degree with which to rotate the RectTransform

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.rotateAround(gameObject.GetComponent<RectTransform>(), Vector3.forward, 90f, 1f).setDelay(1f);

LeanTween.rotateAroundLocal

(
  • gameObject:GameObject
  • vec:Vector3
  • degrees:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1609

Rotate a GameObject around a certain Axis in Local Space (the best method to use when you want to rotate beyond 180 degrees)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to rotate

  • vec:Vector3 Vector3

    axis in which to rotate around ex: Vector3.up

  • degrees:float Float

    the degrees in which to rotate

  • time:float Float

    time The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example:
LeanTween.rotateAround ( gameObject, Vector3.left, 90f, 1f );

LeanTween.rotateAroundLocal (RectTransform)

(
  • rectTrans:RectTransform
  • axis:Vector3
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:2046

Rotate a RectTransform object around it's local axis (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • axis:Vector3 Vector3

    The local axis in which to rotate the RectTransform (Vector3.forward is most commonly used)

  • to:float Float

    The degree with which to rotate the RectTransform

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.rotateAroundLocal(gameObject.GetComponent<RectTransform>(), Vector3.forward, 90f, 1f).setDelay(1f);

LeanTween.rotateLocal

(
  • gameObject:GameObject
  • to:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1540

Rotate a GameObject in the objects local space (on the transforms localEulerAngles object)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to rotate

  • to:Vector3 Vector3

    The final rotation with which to rotate to

  • time:float Float

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateX

(
  • GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1553

Rotate a GameObject only on the X axis

Rotate a GameObject only on the X axis

Parameters:

  • GameObject GameObject

    Gameobject that you wish to rotate

  • to:float Float

    The final x-axis rotation with which to rotate

  • time:float Float

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateY

(
  • GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1566

Rotate a GameObject only on the Y axis

Parameters:

  • GameObject GameObject

    Gameobject that you wish to rotate

  • to:float Float

    The final y-axis rotation with which to rotate

  • time:float Float

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateZ

(
  • GameObject
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1579

Rotate a GameObject only on the Z axis

Parameters:

  • GameObject GameObject

    Gameobject that you wish to rotate

  • to:float Float

    The final z-axis rotation with which to rotate

  • time:float Float

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.scale

(
  • gameObject:GameObject
  • vec:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1626

Scale a GameObject to a certain size

Parameters:

  • gameObject:GameObject GameObject

    gameObject Gameobject that you wish to scale

  • vec:Vector3 Vector3

    to The size with which to tween to

  • time:float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.scale (GUI)

(
  • LTRect
  • Vector2
  • float
)
LTDescr

Defined in LeanTween.cs:1639

Scale a GUI Element to a certain width and height

Parameters:

  • LTRect LTRect

    ltRect LTRect object that you wish to move

  • Vector2 Vector2

    to The final width and height to scale to (pixel based)

  • float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
var bRect:LTRect = new LTRect( 0, 0, 100, 50 );
LeanTween.scale( bRect, Vector2(bRect.rect.width, bRect.rect.height) * 1.3, 0.25 ).setEase(LeanTweenType.easeOutBounce);
function OnGUI(){
  if(GUI.Button(bRect.rect, "Scale")){ }
}

Example C#:
LTRect bRect = new LTRect( 0f, 0f, 100f, 50f );
LeanTween.scale( bRect, new Vector2(150f,75f), 0.25f ).setEase(LeanTweenType.easeOutBounce);
void OnGUI(){
  if(GUI.Button(bRect.rect, "Scale")){ }
}

LeanTween.scale (RectTransform)

(
  • rectTrans:RectTransform
  • to:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:2061

Scale a RectTransform object (used in Unity GUI in 4.6+, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:Vector3 Vector3

    The final Vector3 with which to tween to (localScale)

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.scale(gameObject.GetComponent<RectTransform>(), gameObject.GetComponent<RectTransform>().localScale*2f, 1f).setDelay(1f);

LeanTween.scaleX

(
  • gameObject:GameObject
  • scaleTo:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1666

Scale a GameObject to a certain size along the x-axis only

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to scale

  • scaleTo:float Float

    the size with which to scale to

  • time:float Float

    the time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.scaleY

(
  • gameObject:GameObject
  • scaleTo:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1679

Scale a GameObject to a certain size along the y-axis only

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to scale

  • scaleTo:float Float

    the size with which to scale to

  • time:float Float

    the time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.scaleZ

(
  • gameObject:GameObject
  • scaleTo:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1692

Scale a GameObject to a certain size along the z-axis only

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to scale

  • scaleTo:float Float

    the size with which to scale to

  • time:float Float

    the time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.sequence

() LTSeq

Defined in LeanTween.cs:1041

Retrieve a sequencer object where you can easily chain together tweens and methods one after another

Returns:

LTSeq:

LTSeq an object that you can add tweens, methods and time on to

Example:

var seq = LeanTween.sequence();
seq.add(1f); // delay everything one second
seq.add( () => { // fire an event before start
 Debug.Log("I have started");
});
seq.add( LeanTween.move(cube1, Vector3.one * 10f, 1f) ); // do a tween
seq.add( () => { // fire event after tween
 Debug.Log("We are done now");
});;

LeanTween.size (RectTransform)

(
  • rectTrans:RectTransform
  • to:Vector2
  • time:float
)
LTDescr

Defined in LeanTween.cs:2075

Change the sizeDelta of a RectTransform object (used in Unity Canvas, for Buttons, Panel, Scrollbar, etc...)

Parameters:

  • rectTrans:RectTransform RectTransform

    RectTransform that you wish to attach the tween to

  • to:Vector2 Vector2

    The final Vector2 the tween will end at for sizeDelta property

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

LeanTween.size(gameObject.GetComponent<RectTransform>(), gameObject.GetComponent<RectTransform>().sizeDelta*2f, 1f).setDelay(1f);

LeanTween.tweensRunning

()

Defined in LeanTween.cs:290

Find out how many tweens you have animating at a given time

Example:

Debug.Log("I have "+LeanTween.tweensRunning+" animating!");

LeanTween.value (Color)

(
  • GameObject
  • callOnUpdate:Action<Color>
  • Color
  • Color
  • Color
)
LTDescr

Defined in LeanTween.cs:1867

Tween from one color to another

Parameters:

  • GameObject GameObject

    gameObject GameObject with which to tie the tweening with. This is only used when you need to cancel this tween, it does not actually perform any operations on this gameObject

  • callOnUpdate:Action<Color> Action

    The function that is called on every Update frame, this function needs to accept a color value ex: function updateValue( Color val ){ }

  • Color Color

    from The original value to start the tween from

  • Color Color

    to The value to end the tween on

  • Color Color

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, updateValueExampleCallback, Color.red, Color.green, 1f).setEase(LeanTweenType.easeOutElastic);
function updateValueExampleCallback( val:Color ){
  Debug.Log("tweened color:"+val+" set this to whatever variable you are tweening...");
}

Example C#:
LeanTween.value( gameObject, updateValueExampleCallback, Color.red, Color.green, 1f).setEase(LeanTweenType.easeOutElastic);
void updateValueExampleCallback( Color val ){
  Debug.Log("tweened color:"+val+" set this to whatever variable you are tweening...");
}

LeanTween.value (Color)

(
  • gameObject:GameObject
  • from:Color
  • to:Color
  • time:float
)
LTDescr

Defined in LeanTween.cs:1780

Tween any particular value (Color)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • from:Color Color

    The original value to start the tween from

  • to:Color Color

    The final Color with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, Color.red, Color.yellow, 5f).setOnUpdate( function( val:Color ){
 Debug.Log("tweened val:"+val);
} );

Example C#:
LeanTween.value( gameObject, Color.red, Color.yellow, 5f).setOnUpdate( (Color val)=>{
 Debug.Log("tweened val:"+val);
} );

LeanTween.value (float)

(
  • gameObject:GameObject
  • from:float
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1705

Tween any particular value (float)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • from:float Float

    The original value to start the tween from

  • to:float Vector3

    The final float with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, 1f, 5f, 5f).setOnUpdate( function( val:float ){
 Debug.Log("tweened val:"+val);
} );

Example C#:
LeanTween.value( gameObject, 1f, 5f, 5f).setOnUpdate( (float val)=>{
 Debug.Log("tweened val:"+val);
} );

LeanTween.value (float)

(
  • GameObject
  • callOnUpdateRatio:Action<float,float>
  • float
  • float
  • float
)
LTDescr

Defined in LeanTween.cs:1839

Tweens any float value, it does not need to be tied to any particular type or GameObject

Parameters:

  • GameObject GameObject

    gameObject GameObject with which to tie the tweening with. This is only used when you need to cancel this tween, it does not actually perform any operations on this gameObject

  • callOnUpdateRatio:Action<float,float> Action

    Function that's called every Update frame. It must accept two float values ex: function updateValue( float val, float ratio){ }

  • float Float

    from The original value to start the tween from

  • float Float

    to The value to end the tween on

  • float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
function updateValueExampleCallback( val:float, ratio:float ){
  Debug.Log("tweened value:"+val+" percent complete:"+ratio100);
}

Example C#:
LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
void updateValueExampleCallback( float val, float ratio ){
  Debug.Log("tweened value:"+val+" percent complete:"+ratio
100);
}

LeanTween.value (float)

(
  • GameObject
  • callOnUpdate:Action<float>
  • float
  • float
  • float
)
LTDescr

Defined in LeanTween.cs:1811

Tween any particular value, it does not need to be tied to any particular type or GameObject

Parameters:

  • GameObject GameObject

    gameObject GameObject with which to tie the tweening with. This is only used when you need to cancel this tween, it does not actually perform any operations on this gameObject

  • callOnUpdate:Action<float> Action

    The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( float val ){ }

  • float Float

    from The original value to start the tween from

  • float Float

    to The value to end the tween on

  • float Float

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
function updateValueExampleCallback( val:float ){
  Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
}

Example C#:
LeanTween.value( gameObject, updateValueExampleCallback, 180f, 270f, 1f).setEase(LeanTweenType.easeOutElastic);
void updateValueExampleCallback( float val ){
  Debug.Log("tweened value:"+val+" set this to whatever variable you are tweening...");
}

LeanTween.value (float,object)

(
  • gameObject:GameObject
  • callOnUpdate:Action<float,object>
  • from:float
  • to:float
  • time:float
)
LTDescr

Defined in LeanTween.cs:1930

Tween any particular value (float)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • callOnUpdate:Action<float,object> Action

    The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val, object obj ){ }

  • from:float Float

    The original value to start the tween from

  • to:float Vector3

    The final Vector3 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.value (Vector2)

(
  • gameObject:GameObject
  • callOnUpdate:Action<Vector2>
  • from:Vector2
  • to:Vector2
  • time:float
)
LTDescr

Defined in LeanTween.cs:1900

Tween any particular value (Vector2), this could be used to tween an arbitrary value like offset property

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • callOnUpdate:Action<Vector2> Action

    The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val ){ }

  • from:Vector2 Float

    The original value to start the tween from

  • to:Vector2 Vector2

    The final Vector3 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.value (Vector2)

(
  • gameObject:GameObject
  • from:Vector2
  • to:Vector2
  • time:float
)
LTDescr

Defined in LeanTween.cs:1732

Tween any particular value (Vector2)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • from:Vector2 Vector2

    The original value to start the tween from

  • to:Vector2 Vector3

    The final Vector2 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, new Vector2(1f,0f), new Vector3(5f,0f), 5f).setOnUpdate( function( val:Vector2 ){
 Debug.Log("tweened val:"+val);
} );

Example C#:
LeanTween.value( gameObject, new Vector3(1f,0f), new Vector3(5f,0f), 5f).setOnUpdate( (Vector2 val)=>{
 Debug.Log("tweened val:"+val);
} );

LeanTween.value (Vector3)

(
  • gameObject:GameObject
  • from:Vector3
  • to:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1756

Tween any particular value (Vector3)

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • from:Vector3 Vector3

    The original value to start the tween from

  • to:Vector3 Vector3

    The final Vector3 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example Javascript:
LeanTween.value( gameObject, new Vector3(1f,0f,0f), new Vector3(5f,0f,0f), 5f).setOnUpdate( function( val:Vector3 ){
 Debug.Log("tweened val:"+val);
} );

Example C#:
LeanTween.value( gameObject, new Vector3(1f,0f,0f), new Vector3(5f,0f,0f), 5f).setOnUpdate( (Vector3 val)=>{
 Debug.Log("tweened val:"+val);
} );

LeanTween.value (Vector3)

(
  • gameObject:GameObject
  • callOnUpdate:Action<Vector3>
  • from:Vector3
  • to:Vector3
  • time:float
)
LTDescr

Defined in LeanTween.cs:1915

Tween any particular value (Vector3), this could be used to tween an arbitrary property that uses a Vector

Parameters:

  • gameObject:GameObject GameObject

    Gameobject that you wish to attach the tween to

  • callOnUpdate:Action<Vector3> Action

    The function that is called on every Update frame, this function needs to accept a float value ex: function updateValue( Vector3 val ){ }

  • from:Vector3 Float

    The original value to start the tween from

  • to:Vector3 Vector3

    The final Vector3 with which to tween to

  • time:float Float

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween