Tween 动画类

??

使用

示例用法 (将此脚本附加到一个游戏物体):

数组,它将显示您的对象,如 Positions/Rotations/Alphas有 5 的参数,这种工作方式:

Total Time:此操作将需要多长时间。

Delay:此操作将等多久才能启动。(如果此操作有一个或多个操作在它之前,你可能想添加所用总的时间)

Ease:你想要对此"tween"什么样的行为呢

Tween Value:最后Translation/Rotation/Alpha 的元素。

Loop Array:将它循环吗?

UnityTween.cs  (多次使用了foreach在实际使用应该改为for)

using UnityEngine;
using System.Collections;

//Tween position object class
[System.Serializable]
public class TweenPositionObject : BaseTweenObject
{
	public Vector3 tweenValue;

	private Vector3 _startValue;
	public Vector3 startValue
	{
		set{_startValue = value;}
		get{return _startValue;}
	}

	public TweenPositionObject ()
	{
		this.tweenType = TweenType.TweenPosition;
	}
}

//Tween rotation object class
[System.Serializable]
public class TweenRotationObject : BaseTweenObject
{
	public Vector3 tweenValue;

	private Vector3 _startValue;
	public Vector3 startValue
	{
		set{_startValue = value;}
		get{return _startValue;}
	}

	public TweenRotationObject ()
	{
		this.tweenType = TweenType.TweenRotation;
	}
}

//Tween Alpha object class
[System.Serializable]
public class TweenAlphaObject : BaseTweenObject
{
	public float tweenValue;

	private float _startValue;
	public float startValue
	{
		set{_startValue = value;}
		get{return _startValue;}
	}

	public TweenAlphaObject ()
	{
		this.tweenType = TweenType.TweenAlpha;
	}
}

//Engine class
public class UnityTween : MonoBehaviour {

	public TweenPositionObject[] positions =  new TweenPositionObject[0];
	public TweenRotationObject[] rotations =  new TweenRotationObject[0];
	public TweenAlphaObject[] alphas =  new TweenAlphaObject[0];

	public bool loopArray;

	private ArrayList tweens;

	void Start () {

		this.tweens = new ArrayList();
		this.AddTweens();
	}

	private void AddTweens ()
	{
		foreach(TweenPositionObject tween in positions)
		{
			TweenPosition(tween);
		}
		foreach(TweenRotationObject tween in rotations)
		{
			TweenRotation(tween);
		}
		foreach(TweenAlphaObject tween in alphas)
		{
			TweenAlpha(tween);
		}
	}
	//Add Tween in arrayList
	//Tween position
	public void TweenPosition (TweenPositionObject obj)
	{
		TweenPositionObject tween = new TweenPositionObject();

		tween.startTime = Time.time;
		tween.CopyTween(obj);
		tween.tweenValue = obj.tweenValue;
		tween.Init();

		this.tweens.Add(tween);
	}
	//Tween rotation
	public void TweenRotation (TweenRotationObject obj)
	{
		TweenRotationObject tween = new TweenRotationObject();

		tween.startTime = Time.time;
		tween.CopyTween(obj);
		tween.tweenValue = obj.tweenValue;
		tween.Init();

		this.tweens.Add(tween);
	}
	//Tween alpha
	public void TweenAlpha (TweenAlphaObject obj)
	{
		TweenAlphaObject tween = new TweenAlphaObject();

		tween.startTime = Time.time;
		tween.CopyTween(obj);
		tween.tweenValue = obj.tweenValue;
		tween.Init();

		this.tweens.Add(tween);
	}

	//Clear Tweens with the same type
	private void ClearTweensSameType (BaseTweenObject obj)
	{
		foreach (BaseTweenObject tween in tweens)
		{
			if(tween.id != obj.id && tween.tweenType == obj.tweenType)
				tween.ended = true;
		}
	}

	//Updates
	void Update ()
	{
		this.DetectDelay();
		this.UpdateTween();
	}
	//Detect when delay was passed
	private void DetectDelay ()
	{
		foreach (BaseTweenObject tween in tweens)
		{
			if(Time.time > tween.startTime + tween.delay && !tween.canStart)
			{
				if(tween.tweenType == TweenType.TweenPosition)
				{
					TweenPositionObject tweenPos = tween as TweenPositionObject;
					tweenPos.startValue = this.transform.position;
				}
				else if(tween.tweenType == TweenType.TweenRotation)
				{
					TweenRotationObject tweenRot = tween as TweenRotationObject;
					tweenRot.startValue = this.transform.rotation.eulerAngles;
				}
				else if(tween.tweenType == TweenType.TweenAlpha)
				{
					TweenAlphaObject tweenAlpha = tween as TweenAlphaObject;
					if(GetComponent<GUITexture>() != null)
						tweenAlpha.startValue = GetComponent<GUITexture>().color.a;
					else
						tweenAlpha.startValue = this.GetComponent<Renderer>().material.color.a;
				}

				this.ClearTweensSameType(tween);

				tween.canStart = true;
			}
		}
	}
	//Update tween by type
	private void UpdateTween ()
	{

		int tweenCompleted = 0;
		foreach (BaseTweenObject tween in tweens)
		{
			if(tween.canStart && !tween.ended)
			{
				if(tween.tweenType == TweenType.TweenPosition)
					UpdatePosition(tween as TweenPositionObject);
				else if(tween.tweenType == TweenType.TweenRotation)
					UpdateRotation(tween as TweenRotationObject);
				else if(tween.tweenType == TweenType.TweenAlpha)
					UpdateAlpha(tween as TweenAlphaObject);	

			}
			if(tween.ended)
				tweenCompleted++;

			if(tweenCompleted == tweens.Count && loopArray)
				this.MakeLoop ();

		}
	}

	private void MakeLoop ()
	{
		foreach (BaseTweenObject tween in tweens)
		{
			tween.ended = false;
			tween.canStart = false;
			tween.startTime = Time.time;
		}
	}

	//Update Position
	private void UpdatePosition(TweenPositionObject tween)
	{
		Vector3 begin = tween.startValue;
		Vector3 finish =  tween.tweenValue;
		Vector3 change =  finish - begin;
		float duration = tween.totalTime;
		float currentTime = Time.time - (tween.startTime + tween.delay);	

		if(duration == 0)
		{
			this.EndTween(tween);
			this.transform.position = finish;
			return;
		}

		if(Time.time  > tween.startTime + tween.delay + duration)
			this.EndTween(tween);

		this.transform.position = Equations.ChangeVector(currentTime, begin, change ,duration, tween.ease);
	}
	//Update Rotation
	private void UpdateRotation(TweenRotationObject tween)
	{
		Vector3 begin = tween.startValue;
		Vector3 finish =  tween.tweenValue;
		Vector3 change =  finish - begin;
		float duration = tween.totalTime;
		float currentTime = Time.time - (tween.startTime + tween.delay);	

		if(duration == 0)
		{
			this.EndTween(tween);
			this.transform.position = finish;
			return;
		}

		if(Time.time  > tween.startTime + tween.delay + duration)
			this.EndTween(tween);

		this.transform.rotation = Quaternion.Euler(Equations.ChangeVector(currentTime, begin, change ,duration, tween.ease));
	}
	//Update Alpha
	private void UpdateAlpha(TweenAlphaObject tween)
	{
		float begin = tween.startValue;
		float finish =  tween.tweenValue;
		float change =  finish - begin;
		float duration = tween.totalTime;
		float currentTime = Time.time - (tween.startTime + tween.delay);	

		float alpha = Equations.ChangeFloat(currentTime, begin, change ,duration, tween.ease);
		float redColor;
		float redGreen;
		float redBlue;

		if(GetComponent<GUITexture>() != null)
		{
			redColor = GetComponent<GUITexture>().color.r;
			redGreen = GetComponent<GUITexture>().color.g;
			redBlue = GetComponent<GUITexture>().color.b;

			GetComponent<GUITexture>().color = new Color(redColor,redGreen,redBlue,alpha);

			if(duration == 0)
			{
				this.EndTween(tween);
				GetComponent<GUITexture>().color = new Color(redColor,redGreen,redBlue,finish);
				return;
			}
		}
		else
		{
			redColor = this.GetComponent<Renderer>().material.color.r;
			redGreen = this.GetComponent<Renderer>().material.color.g;
			redBlue = this.GetComponent<Renderer>().material.color.b;

			this.GetComponent<Renderer>().material.color = new Color(redColor,redGreen,redBlue,alpha);

			if(duration == 0)
			{
				this.EndTween(tween);
				this.GetComponent<Renderer>().material.color = new Color(redColor,redGreen,redBlue,finish);
				return;
			}
		}

		if(Time.time  > tween.startTime + tween.delay + duration)
			this.EndTween(tween);
	}	

	private void EndTween (BaseTweenObject tween)
	{
		tween.ended = true;
	}
}

Tween.cs

using UnityEngine;
using System.Collections;

public enum Ease {
	Linear = 0,
	EaseInQuad = 1,
	EaseOutQuad = 2,
	EaseInOutQuad = 3,
	EaseOutInQuad = 4,
	EaseInCubic = 5,
	EaseOutCubic = 6,
	EaseInOutCubic = 7,
	EaseOutInCubic = 8,
	EaseInQuart = 9,
	EaseOutQuart = 10,
	EaseInOutQuart = 11,
	EaseOutInQuart = 12,
	EaseInQuint = 13,
	EaseOutQuint = 14,
	EaseInOutQuint = 15,
	EaseOutInQuint = 16,
	EaseInSine = 17,
	EaseOutSine = 18,
	EaseInOutSine = 19,
	EaseOutInSine = 20,
	EaseInExpo = 21,
	EaseOutExpo = 22,
	EaseInOutExpo = 23,
	EaseOutInExpo = 24,
	EaseInCirc = 25,
	EaseOutCirc = 26,
	EaseInOutCirc = 27,
	EaseOutInCirc = 28,
	EaseInElastic = 29,
	EaseOutElastic = 30,
	EaseInOutElastic = 31,
	EaseOutInElastic = 32,
	EaseInBack = 33,
	EaseOutBack = 34,
	EaseInOutBack = 35,
	EaseOutInBack = 36,
	EaseInBounce = 37,
	EaseOutBounce = 38,
	EaseInOutBounce = 39,
	EaseOutInBounce = 40
}

public class Equations {

	// TWEENING EQUATIONS floats -----------------------------------------------------------------------------------------------------
	// (the original equations are Robert Penner‘s work as mentioned on the disclaimer)

	/**
	 * Easing equation float for a simple linear tweening, with no easing.
	 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */

	public static float EaseNone (float t, float b, float c, float d) {
		return c * t / d + b;
	}

	/**
	 * Easing equation float for a quadratic (t^2) easing in: accelerating from zero velocity.
	 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseInQuad (float t, float b, float c, float d) {
		return c * (t/=d) * t + b;
	}

	/**
	 * Easing equation float for a quadratic (t^2) easing out: decelerating to zero velocity.
	 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseOutQuad (float t, float b, float c, float d) {
		return -c *(t/=d)*(t-2) + b;
	}

	/**
	 * Easing equation float for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration.
	 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseInOutQuad  (float t, float b, float c, float d) {

		if ((t/=d/2) < 1) return c/2*t*t + b;

		return -c/2 * ((--t)*(t-2) - 1) + b;
	}

	/**
	 * Easing equation float for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration.
	 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseOutInQuad (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutQuad (t*2, b, c/2, d);
		return EaseInQuad((t*2)-d, b+c/2, c/2, d);
	}

	/**
	 * Easing equation float for a cubic (t^3) easing in: accelerating from zero velocity.
		 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseInCubic (float t, float b, float c, float d) {
		return c*(t/=d)*t*t + b;
	}

	/**
	 * Easing equation float for a cubic (t^3) easing out: decelerating from zero velocity.
		 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseOutCubic (float t, float b, float c, float d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	}

	/**
	 * Easing equation float for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration.
		 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseInOutCubic (float t, float b, float c, float d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	}

	/**
	 * Easing equation float for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration.
		 *
	 * @param t		Current time (in frames or seconds).
	 * @param b		Starting value.
	 * @param c		Change needed in value.
	 * @param d		Expected easing duration (in frames or seconds).
	 * @return		The correct value.
	 */
	public static float EaseOutInCubic (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutCubic (t*2, b, c/2, d);
		return EaseInCubic((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a quartic (t^4) easing in: accelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInQuart (float t, float b, float c, float d) {
		return c*(t/=d)*t*t*t + b;
	}

	/**
		 * Easing equation float for a quartic (t^4) easing out: decelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutQuart (float t, float b, float c, float d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	}

	/**
		 * Easing equation float for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutQuart (float t, float b, float c, float d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	}

	/**
		 * Easing equation float for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInQuart (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutQuart (t*2, b, c/2, d);
		return EaseInQuart((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a quintic (t^5) easing in: accelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInQuint (float t, float b, float c, float d) {
		return c*(t/=d)*t*t*t*t + b;
	}

	/**
		 * Easing equation float for a quintic (t^5) easing out: decelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutQuint (float t, float b, float c, float d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}

	/**
		 * Easing equation float for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutQuint (float t, float b, float c, float d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	}

	/**
		 * Easing equation float for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInQuint (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutQuint (t*2, b, c/2, d);
		return EaseInQuint((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInSine (float t, float b, float c, float d) {
		return -c * Mathf.Cos(t/d * (Mathf.PI/2)) + c + b;
	}

	/**
		 * Easing equation float for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutSine (float t, float b, float c, float d) {
		return c * Mathf.Sin(t/d * (Mathf.PI/2)) + b;
	}

	/**
		 * Easing equation float for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutSine (float t, float b, float c, float d) {
		return -c/2 * (Mathf.Cos(Mathf.PI*t/d) - 1) + b;
	}

	/**
		 * Easing equation float for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInSine (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutSine (t*2, b, c/2, d);
		return EaseInSine((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for an exponential (2^t) easing in: accelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInExpo (float t, float b, float c, float d) {
		return (t==0) ? b : c * Mathf.Pow(2, 10 * (t/d - 1)) + b - c * 0.001f;
	}

	/**
		 * Easing equation float for an exponential (2^t) easing out: decelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutExpo (float t, float b, float c, float d) {
		return (t==d) ? b+c : c * 1.001f * (-Mathf.Pow(2, -10 * t/d) + 1) + b;
	}

	/**
		 * Easing equation float for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutExpo (float t, float b, float c, float d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Mathf.Pow(2, 10 * (t - 1)) + b - c * 0.0005f;
		return c/2 * 1.0005f * (-Mathf.Pow(2, -10 * --t) + 2) + b;
	}

	/**
		 * Easing equation float for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInExpo (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutExpo (t*2, b, c/2, d);
		return EaseInExpo((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInCirc (float t, float b, float c, float d) {
		return -c * (Mathf.Sqrt(1 - (t/=d)*t) - 1) + b;
	}

	/**
		 * Easing equation float for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutCirc (float t, float b, float c, float d) {
		return c * Mathf.Sqrt(1 - (t=t/d-1)*t) + b;
	}

	/**
		 * Easing equation float for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration.
 		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutCirc (float t, float b, float c, float d) {
		if ((t/=d/2) < 1) return -c/2 * (Mathf.Sqrt(1 - t*t) - 1) + b;
		return c/2 * (Mathf.Sqrt(1 - (t-=2)*t) + 1) + b;
	}

	/**
		 * Easing equation float for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInCirc (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutCirc (t*2, b, c/2, d);
		return EaseInCirc((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param a		Amplitude.
		 * @param p		Period.
		 * @return		The correct value.
		 */
	public static float EaseInElastic (float t, float b, float c, float d) {
		if (t==0) return b;
		if ((t/=d)==1) return b+c;
		float p =  d *.3f;
		float s = 0;
		float a = 0;
		if (a == 0f || a < Mathf.Abs(c)) {
			a = c;
			s = p/4;
		} else {
			s = p/(2*Mathf.PI) * Mathf.Asin (c/a);
		}
		return -(a*Mathf.Pow(2,10*(t-=1)) * Mathf.Sin( (t*d-s)*(2*Mathf.PI)/p )) + b;
	}

	/**
		 * Easing equation float for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param a		Amplitude.
		 * @param p		Period.
		 * @return		The correct value.
		 */
	public static float EaseOutElastic (float t, float b, float c, float d) {
		if (t==0) return b;
		if ((t/=d)==1) return b+c;
		float p = d*.3f;
		float s = 0;
		float a = 0;
		if (a == 0f || a < Mathf.Abs(c)) {
			a = c;
			s = p/4;
		} else {
			s = p/(2*Mathf.PI) * Mathf.Asin (c/a);
		}
		return (a*Mathf.Pow(2,-10*t) * Mathf.Sin( (t*d-s)*(2*Mathf.PI)/p ) + c + b);
	}

	/**
		 * Easing equation float for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param a		Amplitude.
		 * @param p		Period.
		 * @return		The correct value.
		 */
	public static float EaseInOutElastic (float t, float b, float c, float d) {
		if (t==0) return b;
		if ((t/=d/2)==2) return b+c;
		float p =  d*(.3f*1.5f);
		float s = 0;
		float a = 0;
		if (a == 0f || a < Mathf.Abs(c)) {
			a = c;
			s = p/4;
		} else {
			s = p/(2*Mathf.PI) * Mathf.Asin (c/a);
		}
		if (t < 1) return -.5f*(a*Mathf.Pow(2,10*(t-=1)) * Mathf.Sin( (t*d-s)*(2*Mathf.PI)/p )) + b;
		return a*Mathf.Pow(2,-10*(t-=1)) * Mathf.Sin( (t*d-s)*(2*Mathf.PI)/p )*.5f + c + b;
	}

	/**
		 * Easing equation float for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param a		Amplitude.
		 * @param p		Period.
		 * @return		The correct value.
		 */
	public static float EaseOutInElastic (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutElastic (t*2, b, c/2, d);
		return EaseInElastic((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param s		Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
		 * @return		The correct value.
		 */
	public static float EaseInBack (float t, float b, float c, float d) {
		float s = 1.70158f;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	}

	/**
		 * Easing equation float for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param s		Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
		 * @return		The correct value.
		 */
	public static float EaseOutBack (float t, float b, float c, float d) {
		float s = 1.70158f;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	}

	/**
		 * Easing equation float for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param s		Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
		 * @return		The correct value.
		 */
	public static float EaseInOutBack (float t, float b, float c, float d) {
		float s =  1.70158f;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525f))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525f))+1)*t + s) + 2) + b;
	}

	/**
		 * Easing equation float for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @param s		Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
		 * @return		The correct value.
		 */
	public static float EaseOutInBack (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutBack (t*2, b, c/2, d);
		return EaseInBack((t*2)-d, b+c/2, c/2, d);
	}

	/**
		 * Easing equation float for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInBounce (float t, float b, float c, float d) {
		return c - EaseOutBounce (d-t, 0, c, d) + b;
	}

	/**
		 * Easing equation float for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutBounce (float t, float b, float c, float d) {
		if ((t/=d) < (1/2.75f)) {
			return c*(7.5625f*t*t) + b;
		} else if (t < (2/2.75f)) {
			return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
		} else if (t < (2.5f/2.75f)) {
			return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
		} else {
			return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
		}
	}

	/**
		 * Easing equation float for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseInOutBounce (float t, float b, float c, float d) {
		if (t < d/2) return EaseInBounce (t*2, 0, c, d) * .5f + b;
		else return EaseOutBounce (t*2-d, 0, c, d) * .5f + c*.5f + b;
	}

	/**
		 * Easing equation float for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
		 *
		 * @param t		Current time (in frames or seconds).
		 * @param b		Starting value.
		 * @param c		Change needed in value.
		 * @param d		Expected easing duration (in frames or seconds).
		 * @return		The correct value.
		 */
	public static float EaseOutInBounce (float t, float b, float c, float d) {
		if (t < d/2) return EaseOutBounce (t*2, b, c/2, d);
		return EaseInBounce((t*2)-d, b+c/2, c/2, d);
	}

	public static Vector3 ChangeVector(float t , Vector3 b , Vector3 c , float d , Ease Ease)
	{
		float x = 0;
		float y = 0;
		float z = 0;

		if(Ease == Ease.Linear)
		{
			x = EaseNone (t , b.x , c.x , d);
			y = EaseNone (t , b.y , c.y , d);
			z = EaseNone (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInQuad)
		{
			x = EaseInQuad (t , b.x , c.x , d);
			y = EaseInQuad (t , b.y , c.y , d);
			z = EaseInQuad (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutQuad)
		{
			x = EaseOutQuad (t , b.x , c.x , d);
			y = EaseOutQuad (t , b.y , c.y , d);
			z = EaseOutQuad (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutQuad)
		{
			x = EaseInOutQuad (t , b.x , c.x , d);
			y = EaseInOutQuad (t , b.y , c.y , d);
			z = EaseInOutQuad (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInQuad)
		{
			x = EaseOutInQuad (t , b.x , c.x , d);
			y = EaseOutInQuad (t , b.y , c.y , d);
			z = EaseOutInQuad (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInCubic)
		{
			x = EaseInCubic (t , b.x , c.x , d);
			y = EaseInCubic (t , b.y , c.y , d);
			z = EaseInCubic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutCubic)
		{
			x = EaseOutCubic (t , b.x , c.x , d);
			y = EaseOutCubic (t , b.y , c.y , d);
			z = EaseOutCubic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutCubic)
		{
			x = EaseInOutCubic (t , b.x , c.x , d);
			y = EaseInOutCubic (t , b.y , c.y , d);
			z = EaseInOutCubic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInCubic)
		{
			x = EaseOutInCubic (t , b.x , c.x , d);
			y = EaseOutInCubic (t , b.y , c.y , d);
			z = EaseOutInCubic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInQuart)
		{
			x = EaseInQuart (t , b.x , c.x , d);
			y = EaseInQuart (t , b.y , c.y , d);
			z = EaseInQuart (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutQuart)
		{
			x = EaseOutQuart (t , b.x , c.x , d);
			y = EaseOutQuart (t , b.y , c.y , d);
			z = EaseOutQuart (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutQuart)
		{
			x = EaseInOutQuart (t , b.x , c.x , d);
			y = EaseInOutQuart (t , b.y , c.y , d);
			z = EaseInOutQuart (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInQuart)
		{
			x = EaseOutInQuart (t , b.x , c.x , d);
			y = EaseOutInQuart (t , b.y , c.y , d);
			z = EaseOutInQuart (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInQuint)
		{
			x = EaseInQuint (t , b.x , c.x , d);
			y = EaseInQuint (t , b.y , c.y , d);
			z = EaseInQuint (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutQuint)
		{
			x = EaseOutQuint (t , b.x , c.x , d);
			y = EaseOutQuint (t , b.y , c.y , d);
			z = EaseOutQuint (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutQuint)
		{
			x = EaseInOutQuint (t , b.x , c.x , d);
			y = EaseInOutQuint (t , b.y , c.y , d);
			z = EaseInOutQuint (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInQuint)
		{
			x = EaseOutInQuint (t , b.x , c.x , d);
			y = EaseOutInQuint (t , b.y , c.y , d);
			z = EaseOutInQuint (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInSine)
		{
			x = EaseInSine (t , b.x , c.x , d);
			y = EaseInSine (t , b.y , c.y , d);
			z = EaseInSine (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutSine)
		{
			x = EaseOutSine (t , b.x , c.x , d);
			y = EaseOutSine (t , b.y , c.y , d);
			z = EaseOutSine (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutSine)
		{
			x = EaseInOutSine (t , b.x , c.x , d);
			y = EaseInOutSine (t , b.y , c.y , d);
			z = EaseInOutSine (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInSine)
		{
			x = EaseOutInSine (t , b.x , c.x , d);
			y = EaseOutInSine (t , b.y , c.y , d);
			z = EaseOutInSine (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInExpo)
		{
			x = EaseInExpo (t , b.x , c.x , d);
			y = EaseInExpo (t , b.y , c.y , d);
			z = EaseInExpo (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutExpo)
		{
			x = EaseOutExpo (t , b.x , c.x , d);
			y = EaseOutExpo (t , b.y , c.y , d);
			z = EaseOutExpo (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutExpo)
		{
			x = EaseInOutExpo (t , b.x , c.x , d);
			y = EaseInOutExpo (t , b.y , c.y , d);
			z = EaseInOutExpo (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInExpo)
		{
			x = EaseOutInExpo (t , b.x , c.x , d);
			y = EaseOutInExpo (t , b.y , c.y , d);
			z = EaseOutInExpo (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInCirc)
		{
			x = EaseInCirc (t , b.x , c.x , d);
			y = EaseInCirc (t , b.y , c.y , d);
			z = EaseInCirc (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutCirc)
		{
			x = EaseOutCirc (t , b.x , c.x , d);
			y = EaseOutCirc (t , b.y , c.y , d);
			z = EaseOutCirc (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutCirc)
		{
			x = EaseInOutCirc (t , b.x , c.x , d);
			y = EaseInOutCirc (t , b.y , c.y , d);
			z = EaseInOutCirc (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInCirc)
		{
			x = EaseOutInCirc (t , b.x , c.x , d);
			y = EaseOutInCirc (t , b.y , c.y , d);
			z = EaseOutInCirc (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInElastic)
		{
			x = EaseInElastic (t , b.x , c.x , d);
			y = EaseInElastic (t , b.y , c.y , d);
			z = EaseInElastic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutElastic)
		{
			x = EaseOutElastic (t , b.x , c.x , d);
			y = EaseOutElastic (t , b.y , c.y , d);
			z = EaseOutElastic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutElastic)
		{
			x = EaseInOutElastic (t , b.x , c.x , d);
			y = EaseInOutElastic (t , b.y , c.y , d);
			z = EaseInOutElastic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInElastic)
		{
			x = EaseOutInElastic (t , b.x , c.x , d);
			y = EaseOutInElastic (t , b.y , c.y , d);
			z = EaseOutInElastic (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInBack)
		{
			x = EaseInBack (t , b.x , c.x , d);
			y = EaseInBack (t , b.y , c.y , d);
			z = EaseInBack (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutBack)
		{
			x = EaseOutBack (t , b.x , c.x , d);
			y = EaseOutBack (t , b.y , c.y , d);
			z = EaseOutBack (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutBack)
		{
			x = EaseInOutBack (t , b.x , c.x , d);
			y = EaseInOutBack (t , b.y , c.y , d);
			z = EaseInOutBack (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInBack)
		{
			x = EaseOutInBack (t , b.x , c.x , d);
			y = EaseOutInBack (t , b.y , c.y , d);
			z = EaseOutInBack (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInBounce)
		{
			x = EaseInBounce (t , b.x , c.x , d);
			y = EaseInBounce (t , b.y , c.y , d);
			z = EaseInBounce (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutBounce)
		{
			x = EaseOutBounce (t , b.x , c.x , d);
			y = EaseOutBounce (t , b.y , c.y , d);
			z = EaseOutBounce (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseInOutBounce)
		{
			x = EaseInOutBounce (t , b.x , c.x , d);
			y = EaseInOutBounce (t , b.y , c.y , d);
			z = EaseInOutBounce (t , b.z , c.z , d);
		}
		else if(Ease == Ease.EaseOutInBounce)
		{
			x = EaseOutInBounce (t , b.x , c.x , d);
			y = EaseOutInBounce (t , b.y , c.y , d);
			z = EaseOutInBounce (t , b.z , c.z , d);
		}

		return new Vector3(x,y,z);
	}
	public static float ChangeFloat(float t , float b , float c , float d , Ease Ease)
	{
		float value = 0;

		if(Ease == Ease.Linear)
			value = EaseNone (t , b , c , d);
		else if(Ease == Ease.EaseInQuad)
			value = EaseInQuad (t , b , c , d);
		else if(Ease == Ease.EaseOutQuad)
			value = EaseOutQuad (t , b , c , d);
		else if(Ease == Ease.EaseInOutQuad)
			value = EaseInOutQuad (t , b , c , d);
		else if(Ease == Ease.EaseOutInQuad)
			value = EaseOutInQuad (t , b , c , d);
		else if(Ease == Ease.EaseInCubic)
			value = EaseInCubic (t , b , c , d);
		else if(Ease == Ease.EaseOutCubic)
			value = EaseOutCubic (t , b , c , d);
		else if(Ease == Ease.EaseInOutCubic)
			value = EaseInOutCubic (t , b , c , d);
		else if(Ease == Ease.EaseOutInCubic)
			value = EaseOutInCubic (t , b , c , d);
		else if(Ease == Ease.EaseInQuart)
			value = EaseInQuart (t , b , c , d);
		else if(Ease == Ease.EaseOutQuart)
			value = EaseOutQuart (t , b , c , d);
		else if(Ease == Ease.EaseInOutQuart)
			value = EaseInOutQuart (t , b , c , d);
		else if(Ease == Ease.EaseOutInQuart)
			value = EaseOutInQuart (t , b , c , d);
		else if(Ease == Ease.EaseInQuint)
			value = EaseInQuint (t , b , c , d);
		else if(Ease == Ease.EaseOutQuint)
			value = EaseOutQuint (t , b , c , d);
		else if(Ease == Ease.EaseInOutQuint)
			value = EaseInOutQuint (t , b , c , d);
		else if(Ease == Ease.EaseOutInQuint)
			value = EaseOutInQuint (t , b , c , d);
		else if(Ease == Ease.EaseInSine)
			value = EaseInSine (t , b , c , d);
		else if(Ease == Ease.EaseOutSine)
			value = EaseOutSine (t , b , c , d);
		else if(Ease == Ease.EaseInOutSine)
			value = EaseInOutSine (t , b , c , d);
		else if(Ease == Ease.EaseOutInSine)
			value = EaseOutInSine (t , b , c , d);
		else if(Ease == Ease.EaseInExpo)
			value = EaseInExpo (t , b , c , d);
		else if(Ease == Ease.EaseOutExpo)
			value = EaseOutExpo (t , b , c , d);
		else if(Ease == Ease.EaseInOutExpo)
			value = EaseInOutExpo (t , b , c , d);
		else if(Ease == Ease.EaseOutInExpo)
			value = EaseOutInExpo (t , b , c , d);
		else if(Ease == Ease.EaseInCirc)
			value = EaseInCirc (t , b , c , d);
		else if(Ease == Ease.EaseOutCirc)
			value = EaseOutCirc (t , b , c , d);
		else if(Ease == Ease.EaseInOutCirc)
			value = EaseInOutCirc (t , b , c , d);
		else if(Ease == Ease.EaseOutInCirc)
			value = EaseOutInCirc (t , b , c , d);
		else if(Ease == Ease.EaseInElastic)
			value = EaseInElastic (t , b , c , d);
		else if(Ease == Ease.EaseOutElastic)
			value = EaseOutElastic (t , b , c , d);
		else if(Ease == Ease.EaseInOutElastic)
			value = EaseInOutElastic (t , b , c , d);
		else if(Ease == Ease.EaseOutInElastic)
			value = EaseOutInElastic (t , b , c , d);
		else if(Ease == Ease.EaseInBack)
			value = EaseInBack (t , b , c , d);
		else if(Ease == Ease.EaseOutBack)
			value = EaseOutBack (t , b , c , d);
		else if(Ease == Ease.EaseInOutBack)
			value = EaseInOutBack (t , b , c , d);
		else if(Ease == Ease.EaseOutInBack)
			value = EaseOutInBack (t , b , c , d);
		else if(Ease == Ease.EaseInBounce)
			value = EaseInBounce (t , b , c , d);
		else if(Ease == Ease.EaseOutBounce)
			value = EaseOutBounce (t , b , c , d);
		else if(Ease == Ease.EaseInOutBounce)
			value = EaseInOutBounce (t , b , c , d);
		else if(Ease == Ease.EaseOutInBounce)
			value = EaseOutInBounce (t , b , c , d);

		return value;
	}

}

BaseTweenObject.cs

using UnityEngine;
using System.Collections;

public enum TweenType {
	TweenPosition = 0,
	TweenRotation = 1,
	TweenAlpha = 2
}

public class BaseTweenObject {

	public float totalTime = 0;
	public float delay = 0;
	public Ease ease = Ease.Linear;	

	private TweenType _tweenType;
	public TweenType tweenType
	{
		set{_tweenType = value;}
		get{return _tweenType;}
	}

	private float _startTime;
	public float startTime
	{
		set{_startTime = value;}
		get{return _startTime;}
	}

	private bool _ended = false;
	public bool ended
	{
		set{_ended = value;}
		get{return _ended;}
	}

	private bool _canStart = false;
	public bool canStart
	{
		set{_canStart = value;}
		get{return _canStart;}
	}

	private string _id = "";
	public string id
	{
		set{_id = value;}
		get{return _id;}
	}

	public BaseTweenObject ()
	{

	}
	public void Init()
	{
		this.id = "tween" + Time.time.ToString();
	}

	public void CopyTween (BaseTweenObject tween)
	{
		this.totalTime = tween.totalTime;
		this.delay = tween.delay;
		this.ease = tween.ease;
		this.tweenType = tween.tweenType;
	}
}
时间: 2024-10-10 06:41:20

Tween 动画类的相关文章

【Android动画】之Tween动画 (渐变、缩放、位移、旋转)

Android 平台提供了两类动画. 一类是Tween动画,就是对场景里的对象不断的进行图像变化来产生动画效果(旋转.平移.放缩和渐变). 第二类就是 Frame动画,即顺序的播放事先做好的图像,与gif图片原理类似. 下面就讲一下Tweene Animations. 主要类: Animation  动画 AlphaAnimation 渐变透明度 RotateAnimation 画面旋转 ScaleAnimation 渐变尺寸缩放 TranslateAnimation 位置移动 Animatio

【转】android动画之Tween动画 (渐变、缩放、位移、旋转)

原文:http://blog.csdn.net/feng88724/article/details/6318430 Android 平台提供了两类动画. 一类是Tween动画,就是对场景里的对象不断的进行图像变化来产生动画效果(旋转.平移.放缩和渐变). 第二类就是 Frame动画,即顺序的播放事先做好的图像,与gif图片原理类似. 下面就讲一下Tweene Animations. 主要类: Animation   动画 AlphaAnimation 渐变透明度 RotateAnimation

Tween动画实现

Tween动画主要的功能是在绘制动画前设置动画绘制的轨迹,包括时间.位置等等,但Tween动画的缺点是他只能设置起点与结束点的两帧,中间过程全部由系统帮我们完成,所以在帧数比较多的游戏开发中是不太会用的. Tween一共提供了四种动画效果: Scale:缩放动画 Rotate:旋转动画 Translate:移动动画 Alpha:透明渐变动画 Tween与Frame动画类都需要在res\anim路径下创建动画的布局 1.Scale缩放动画 <scale>标签为缩放节点 android:fromX

Android学习笔记-tween动画

Android动画分为Tween动画和Frame动画,近期学习了,体tween动画,现在讲学习的心得以及相关知识介绍如下. Tween又称为补间动画,可以把对象进行缩小.放大.旋转和渐变等操作.    第一: Tween动画四个主要实现类: 1.AlphaAnimation:渐变(颜色)动画,主要控制透明度变化动画类,常使用AlphaAnimation(float fromAlpha, float toAlpha)来构造: fromAlpha:动画开始时的透明度(取值范围为0.0到1.0): t

android动画之:补间动画(Tween动画)

android中Tween动画实现原理:通过对View的内容进行图形变换 (平移.缩放.旋转.透明度)的改变来实现动画效果.动画效果的定义可用XML来做也可以采用编码来做,今天简单讲下用代码来实现Tween动画中的四种动画方式.四种动画分别对就四个动画类: 渐变透明度动画效果 AlphaAnimation 渐变尺寸缩放动画效果 ScaleAnimation 画面位置移动动画效果 TranslateAnimation 画面旋转动画效果 RotateAnimation 1:平移操作 /**Trans

android动画-tween动画实现原理

现有的 Android 动画框架是建立在 View 的级别上的,在 View 类中有一个接口 startAnimation 来使动画开始,startAnimation 函数会将一个 Animation 类别的参数传给 View,这个 Animation 是用来指定我们使用的是哪种动画,现有的动画有平移,缩放,旋转以及 alpha 变换等.如果需要更复杂的效果,我们还可以将这些动画组合起来,这些在下面会讨论到. 要了解 Android 动画是如何画出来的,我们首先要了解 Android 的 Vie

Android的Tween动画的实现框架

在写程序的时候遇到了Tween动画几个问题: 1,  执行动画的时候点击事件仍然在动画开始的位置? 2,  XXXAnimation的构造参数里面的值具体是什么意思? 3,  平移动画中fromXValue和toXValue旋转动画中fromDegrees和toDegrees取负值有什么不同??(相信很多人也有疑惑) 4,  RotateAnimation的int pivotXType, float pivotXValue, int pivotYType, float pivotYValue四个

通过编码和xml文件两种方式实现tween动画

tween有四种动画效果:alpha(透明).rotate(旋转), translate(移动),scale(缩放); 可以通过硬编码和xml文件这两种方式来实现. xml实现: 第一步:在项目的res文件下面新建一个文件夹名字是anim(必须) 第二步:在anim文件夹下面新建新的xml文件,在xml文件中具体设置动画效果 第三步:在Activity中使用 AnimationUtils.loadAnimation(MainActivity.this,R.anim.xx);来获取. 1.alph

Android Tween动画

View Animation, 即显示在view上的Tween Animation Tween动画,本质上不改变View对象本身,只改变它的绘制方式 两种实现方式,一种在xml中定义,一种直接在代码里定义 xml定义方式: 位移动画translate <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk