Skip to content

Instantly share code, notes, and snippets.

@teitei-tk
Created February 21, 2014 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teitei-tk/9126075 to your computer and use it in GitHub Desktop.
Save teitei-tk/9126075 to your computer and use it in GitHub Desktop.
NGUI TweenPosition Example x 座標0 or 350にDURATION分の時間を使いながら移動。
using UnityEngine;
public class TweenPositionTest : MonoBehaviour
{
private GameObject tweenTarget;
public const float DURATION = 0.1f;
public void Start()
{
this.tweenTarget = GameObject.Find("TweenTarget");
}
public void onClick()
{
Vector3 movePosition = new Vector3(0, 0, 0);
TweenPosition twPosition = TweenPosition.Begin( this.tweenTarget, TweenPositionTest.DURATION, movePosition );
twPosition.onFinished += callback;
}
public void onFinishClick()
{
Vector3 movePosition = new Vector3(350.0F, 0, 0);
TweenPosition twPosition = TweenPosition.Begin( this.tweenTarget, TweenPositionTest.DURATION, movePosition );
twPosition.onFinished += callback;
}
private void callback(UITweener tween)
{
Debug.Log("run finished callback");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment