Movatterモバイル変換


[0]ホーム

URL:


- Developed byDented Pixel
API Docs for: LeanTween 2.14

Support LeanTween!

APIs

Games Developed
by
Dented Pixel



Carbon Cutters - A game that activates
real world change.


Monkeyshines - A swinging good time!


Princess Piano - Learn musical notation
in this melodious adventure!
Show:

LeanTween Class

Defined in:LeanTween.cs:1344

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 pass parameters at a later time by saving a reference to what is returned.

Example:
LTDescr d = LeanTween.moveX(gameObject, 1f, 1f);
  ...later set some parameters
d.setOnComplete( onCompleteFunc ).setEase(LeanTweenType.easeInOutBack );

Item Index

Methods

Methods

LeanTween.addListener

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

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

Parameters:

  • caller:GameObjectGameObject

    the gameObject the listener is attached to

  • eventId:intInt

    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

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

Fade a GUI Object

Parameters:

  • ltRect:LTRectLTRect

    LTRect that you wish to fade

  • to:floatFloat

    the final alpha value (0-1)

  • time:floatFloat

    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

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

Fade a gameobject's material to a certain alpha value. The material's shader needs to support alpha.Owl labs has some excellent efficient shaders.

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to fade

  • to:floatFloat

    the final alpha value (0-1)

  • time:floatFloat

    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.alphaVertex

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

This works by tweening the vertex colors directly.

Vertex-based coloring is useful because you avoid making a copy of yourobject'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:GameObjectGameObject

    Gameobject that you wish to alpha

  • to:floatFloat

    The alpha value you wish to tween to

  • time:floatFloat

    The time with which to delay before calling the function

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.cancel

(
  • gameObject:GameObject
  • id:int
)

Cancel a specific tween with the provided id

Parameters:

  • gameObject:GameObjectGameObject

    gameObject whose tweens you want to cancel

  • id:intFloat

    unique id that represents that tween

LeanTween.cancel

(
  • ltRect:LTRect
  • id:int
)

Cancel a specific tween with the provided id

Parameters:

  • ltRect:LTRectLTRect

    LTRect object whose tweens you want to cancel

  • id:intFloat

    unique id that represents that tween

LeanTween.cancel

(
  • gameObject:GameObject
)

Cancel all tweens that are currently targeting the gameObject

Parameters:

  • gameObject:GameObjectGameObject

    gameObject whose tweens you wish to cancel

Example:

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

LeanTween.color

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

Change a gameobject's material to a certain color value. The material's shader needs to support color tinting.Owl labs has some excellent efficient shaders.

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to change the color

  • to:ColorColor

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

  • time:floatFloat

    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.dispatchEvent

(
  • eventId:int
  • data:object
)

Tell the added listeners that you are dispatching the event

Parameters:

  • eventId:intInt

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

  • data:objectObject

    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
)

Tell the added listeners that you are dispatching the event

Parameters:

  • eventId:intInt

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

Example:

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

LeanTween.init

(
  • maxSimultaneousTweens:int
)

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:intInteger

    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.isTweening

(
  • ltRect:LTRect
)

Test whether or not a tween is active on a LTRect

Parameters:

  • ltRect:LTRectLTRect

    LTRect that you want to test if it is tweening

LeanTween.isTweening

(
  • gameObject:GameObject
)

Test whether or not a tween is active on a GameObject

Parameters:

  • gameObject:GameObjectGameObject

    GameObject that you want to test if it is tweening

LeanTween.isTweening

(
  • id:int
)

Test whether or not a tween is active or not

Parameters:

  • id:intGameObject

    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
  • vec:Vector3
  • time:float
)
LTDescr

Move a GameObject to a certain location

Parameters:

  • GameObjectGameObject

    gameObject Gameobject that you wish to move

  • vec:Vector3Vector3

    to The final positin with which to move to

  • time:floatFloat

    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

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

Move a GameObject along a set of bezier curves

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to move

  • []Vector3optional

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

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

#"../classes/LTDescr.html">LTDescr

Move a GUI Element to a certain location

Parameters:

  • ltRect:LTRectLTRect

    ltRect LTRect object that you wish to move

  • vec:Vector2Vector2

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

  • time:floatFloat

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveLocal

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

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to move

  • []Vector3optional

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

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

#"../classes/LTDescr.html">LTDescr

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

Parameters:

  • GameObjectGameObject

    gameObject Gameobject that you wish to rotate

  • Vector3Vector3

    to The final positin with which to move to

  • floatFloat

    time The time to complete the tween in

  • HashtableHashtable

    optional Hashtable where you can passoptional items.

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveSpline

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

Move a GameObject through a set of points

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to move

  • []Vector3optional

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

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

#"../classes/LTDescr.html">LTDescr

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to move

  • []Vector3optional

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

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

#"../classes/LTDescr.html">LTDescr

Move a GameObject along the x-axis

Parameters:

  • gameObject:GameObjectGameObject

    gameObject Gameobject that you wish to move

  • to:floatFloat

    to The final position with which to move to

  • time:floatFloat

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveY

(
  • GameObject
  • float
  • float
)
LTDescr

Move a GameObject along the y-axis

Parameters:

  • GameObjectGameObject

    gameObject Gameobject that you wish to move

  • floatFloat

    to The final position with which to move to

  • floatFloat

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.moveZ

(
  • GameObject
  • float
  • float
)
LTDescr

Move a GameObject along the z-axis

Parameters:

  • GameObjectGameObject

    gameObject Gameobject that you wish to move

  • floatFloat

    to The final position with which to move to

  • floatFloat

    time The time to complete the move in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.pause

(
  • gameObject:GameObject
)

Pause all tweens for a GameObject

Parameters:

  • gameObject:GameObjectGameObject

    GameObject whose tweens you want to pause

LeanTween.removeListener

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

Remove an event listener you have added

Parameters:

  • caller:GameObjectGameObject

    the gameObject the listener is attached to

  • eventId:intInt

    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
)

Resume a specific tween

Parameters:

  • id:intInt

    Id of the tween you want to resume ex: int id = LeanTween.MoveX(gameObject, 5, 1.0).id;

LeanTween.resume

(
  • gameObject:GameObject
)

Resume all the tweens on a GameObject

Parameters:

  • gameObject:GameObjectGameObject

    GameObject whose tweens you want to resume

LeanTween.rotate

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

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

Parameters:

  • ltRect:LTRectLTRect

    LTRect that you wish to rotate

  • to:floatFloat

    The final rotation with which to rotate to

  • time:floatFloat

    The time to complete the tween in

  • optional:ArrayArray

    Object Array where you can passoptional 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

(
  • GameObject
  • Vector3
  • float
)
LTDescr

Rotate a GameObject, to values are in passed in degrees

Parameters:

  • GameObjectGameObject

    gameObject Gameobject that you wish to rotate

  • Vector3Vector3

    to The final rotation with which to rotate to

  • floatFloat

    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.rotateAround

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

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to rotate

  • vec:Vector3Vector3

    axis in which to rotate around ex: Vector3.up

  • degrees:floatFloat

    the degrees in which to rotate

  • time:floatFloat

    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

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

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:GameObjectGameObject

    Gameobject that you wish to rotate

  • vec:Vector3Vector3

    axis in which to rotate around ex: Vector3.up

  • degrees:floatFloat

    the degrees in which to rotate

  • time:floatFloat

    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.rotateLocal

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

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to rotate

  • to:Vector3Vector3

    The final rotation with which to rotate to

  • time:floatFloat

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateX

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

Rotate a GameObject only on the X axis

Parameters:

  • GameObjectGameObject

    Gameobject that you wish to rotate

  • to:floatFloat

    The final x-axis rotation with which to rotate

  • time:floatFloat

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateY

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

Rotate a GameObject only on the Y axis

Parameters:

  • GameObjectGameObject

    Gameobject that you wish to rotate

  • to:floatFloat

    The final y-axis rotation with which to rotate

  • time:floatFloat

    The time to complete the rotation in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.rotateZ

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

Rotate a GameObject only on the Z axis

Parameters:

  • GameObjectGameObject

    Gameobject that you wish to rotate

  • to:floatFloat

    The final z-axis rotation with which to rotate

  • time:floatFloat

    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

Scale a GameObject to a certain size

Parameters:

  • gameObject:GameObjectGameObject

    gameObject Gameobject that you wish to scale

  • vec:Vector3Vector3

    to The size with which to tween to

  • time:floatFloat

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.scale (GUI)

(
  • LTRect
  • Vector2
  • float
)
LTDescr

Scale a GUI Element to a certain width and height

Parameters:

  • LTRectLTRect

    ltRect LTRect object that you wish to move

  • Vector2Vector2

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

  • floatFloat

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example #"../classes/LTDescr.html">LTDescr

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to scale

  • scaleTo:floatFloat

    the size with which to scale to

  • time:floatFloat

    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

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to scale

  • scaleTo:floatFloat

    the size with which to scale to

  • time:floatFloat

    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

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

Parameters:

  • gameObject:GameObjectGameObject

    Gameobject that you wish to scale

  • scaleTo:floatFloat

    the size with which to scale to

  • time:floatFloat

    the time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.value (Color)

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

Tween from one color to another

Parameters:

  • GameObjectGameObject

    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 ){ }

  • ColorColor

    from The original value to start the tween from

  • ColorColor

    to The value to end the tween on

  • ColorColor

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example #"../classes/LTDescr.html">LTDescr

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

Parameters:

  • GameObjectGameObject

    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 ){ }

  • floatFloat

    from The original value to start the tween from

  • floatFloat

    to The value to end the tween on

  • floatFloat

    time The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

Example:

Example #"../classes/LTDescr.html">LTDescr

Tween any particular value (float)

Parameters:

  • gameObject:GameObjectGameObject

    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:Vector3Float

    The original value to start the tween from

  • to:Vector3Vector3

    The final Vector3 with which to tween to

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween

LeanTween.value (Vector3)

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

Tween any particular value (Vector3), this could be used to tween an arbitrary value like a material color

Parameters:

  • gameObject:GameObjectGameObject

    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:Vector3Float

    The original value to start the tween from

  • to:Vector3Vector3

    The final Vector3 with which to tween to

  • time:floatFloat

    The time to complete the tween in

Returns:

LTDescr:

LTDescr an object that distinguishes the tween


[8]ページ先頭

©2009-2025 Movatter.jp