ITweenX

From Unify Community Wiki
Revision as of 23:11, 2 March 2012 by Berenger (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Author: Berenger

Contents

Description

Bunch of variables to use with iTween instead of searching the keywords every times.

Usage

Put this script in your Standard Assets/Scripts folder; this way it can be easily used from javascript or Boo. If you declare a public var of type EaseType, you can easily pick the right easetype from the inspector.


Example

public class MyClass: MonoBehaviour
{
	public EaseType easeType;
 
	void Start()
	{
		iTween.ValueTo( gameObject, iTween.Hash( iTweenX.from, 0f, iTweenX.to, 1f, iTweenX.time, 1f,
                                                 iTweenX.onUpdate, "UpdateValue",
                                                 iTweenX.onStart, "OnStart",
                                                 iTweenX.onComplete, "OnComplete",
                                                 iTweenX.easeType, iTweenX.Ease(easeType),
                                                 iTweenX.ignoreTimescale, true ) );
	}
	void UpdateValue(float value){ print( "UpdateValue" ); }
	void OnStart(){ print( "OnStart" ); }
	void OnComplete(){ print( "OnComplete" ); }
}


C# - iTweenX.cs

public enum EaseType
{
	EaseInQuad,
	EaseOutQuad,    
	EaseInOutQuad,  
	EaseInCubic,    
	EaseOutCubic,   
	EaseInOutCubic, 
	EaseInQuart,    
	EaseOutQuart,   
	EaseInOutQuart, 
	EaseInQuint,    
	EaseOutQuint,   
	EaseInOutQuint, 
	EaseInSine,     
	EaseOutSine,    
	EaseInOutSine,  
	EaseInExpo,     
	EaseOutExpo,    
	EaseInOutExpo,  
	EaseInCirc,     
	EaseOutCirc,    
	EaseInOutCirc,  
	Linear,         
	Spring,         
	EaseInBounce,   
	EaseOutBounce,  
	EaseInOutBounce,
	EaseInBack,     
	EaseOutBack,    
	EaseInOutBack,  
	EaseInElastic,  
	EaseOutElastic, 
	EaseInOutElastic
}
 
public static class iTweenX
{	
	public static string easeType =         "easeType";
	public static string easeInQuad =       "easeInQuad";
	public static string easeOutQuad =      "easeOutQuad";
	public static string easeInOutQuad =    "easeInOutQuad";
	public static string easeInCubic =      "easeInCubic";
	public static string easeOutCubic =     "easeOutCubic";
	public static string easeInOutCubic =   "easeInOutCubic";
	public static string easeInQuart =      "easeInQuart";
	public static string easeOutQuart =     "easeOutQuart";
	public static string easeInOutQuart =   "easeInOutQuart";
	public static string easeInQuint =      "easeInQuint";
	public static string easeOutQuint =     "easeOutQuint";
	public static string easeInOutQuint =   "easeInOutQuint";
	public static string easeInSine =       "easeInSine";
	public static string easeOutSine =      "easeOutSine";
	public static string easeInOutSine =    "easeInOutSine";
	public static string easeInExpo =       "easeInExpo";
	public static string easeOutExpo =      "easeOutExpo";
	public static string easeInOutExpo =    "easeInOutExpo";
	public static string easeInCirc =       "easeInCirc";
	public static string easeOutCirc =      "easeOutCirc";
	public static string easeInOutCirc =    "easeInOutCirc";
	public static string linear =           "linear";
	public static string spring =           "spring";
	public static string easeInBounce =     "easeInBounce";
	public static string easeOutBounce =    "easeOutBounce";
	public static string easeInOutBounce =  "easeInOutBounce";
	public static string easeInBack =       "easeInBack";
	public static string easeOutBack =      "easeOutBack";
	public static string easeInOutBack =    "easeInOutBack";
	public static string easeInElastic =    "easeInElastic";
	public static string easeOutElastic =   "easeOutElastic";
	public static string easeInOutElastic = "easeInOutElastic";
 
	public static string time =             "time";
	public static string from =             "from";
	public static string to =               "to";
	public static string onStart =          "onstart";
	public static string onUpdate =         "onupdate";
	public static string onComplete =       "oncomplete";
	public static string ignoreTimescale =  "ignoretimescale";
 
	public static string Ease( EaseType type )
	{
		switch(type)
		{
			case EaseType.EaseInQuad 		: return easeInQuad;
			case EaseType.EaseOutQuad 		: return easeOutQuad;    
			case EaseType.EaseInOutQuad 	: return easeInOutQuad;  
			case EaseType.EaseInCubic 		: return easeInCubic;    
			case EaseType.EaseOutCubic 		: return easeOutCubic;   
			case EaseType.EaseInOutCubic 	: return easeInOutCubic; 
			case EaseType.EaseInQuart 		: return easeInQuart;    
			case EaseType.EaseOutQuart 		: return easeOutQuart;   
			case EaseType.EaseInOutQuart 	: return easeInOutQuart; 
			case EaseType.EaseInQuint 		: return easeInQuint;    
			case EaseType.EaseOutQuint 		: return easeOutQuint;   
			case EaseType.EaseInOutQuint 	: return easeInOutQuint; 
			case EaseType.EaseInSine 		: return easeInSine;     
			case EaseType.EaseOutSine 		: return easeOutSine;    
			case EaseType.EaseInOutSine 	: return easeInOutSine;  
			case EaseType.EaseInExpo 		: return easeInExpo;     
			case EaseType.EaseOutExpo 		: return easeOutExpo;    
			case EaseType.EaseInOutExpo 	: return easeInOutExpo;  
			case EaseType.EaseInCirc 		: return easeInCirc;     
			case EaseType.EaseOutCirc 		: return easeOutCirc;    
			case EaseType.EaseInOutCirc 	: return easeInOutCirc;  
			case EaseType.Linear 			: return linear;         
			case EaseType.Spring 			: return spring;         
			case EaseType.EaseInBounce 		: return easeInBounce;   
			case EaseType.EaseOutBounce 	: return easeOutBounce;  
			case EaseType.EaseInOutBounce 	: return easeInOutBounce;
			case EaseType.EaseInBack 		: return easeInBack;     
			case EaseType.EaseOutBack 		: return easeOutBack;    
			case EaseType.EaseInOutBack 	: return easeInOutBack;  
			case EaseType.EaseInElastic 	: return easeInElastic;  
			case EaseType.EaseOutElastic 	: return easeOutElastic; 
			case EaseType.EaseInOutElastic 	: return easeInOutElastic; 
		}
		return easeInQuad;
	}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox