- Home /
iTween & gesture
Hello
I am using iTween's example pack
there is a slider that controls the movement of the Camera along a Path.
I want to replace the GUI slider(up) with a user drag up
I tried hacking the .js code but I'm not savvy enough
Here is the script on the Camera:
Thanks for looking
public var movePath : Transform[];
public var lookPath : Transform[];
public var lookTarget : Transform;
public var percentage : float;
private var redPosition : float = .07;
private var bluePosition : float = .13;
private var greenPosition : float = .2;
private var purplePosition : float = .0;
//gui styling
//public var font : Font;
private var style : GUIStyle = new GUIStyle();
function Start(){
// style.font=font;
}
function OnGUI(){
percentage=GUI.VerticalSlider(new Rect(Screen.width-20,20,150,Screen.height-40),percentage,1,0);
iTween.PutOnPath(gameObject,movePath,percentage);
iTween.PutOnPath(lookTarget,lookPath,percentage);
transform.LookAt(iTween.PointOnPath(lookPath,percentage));
}
// if(GUI.Button(new Rect(5,Screen.height-25,50,20),"Red")){
// SlideTo(redPosition);
// }
// if(GUI.Button(new Rect(60,Screen.height-25,50,20),"Blue")){
// SlideTo(bluePosition);
// }
// if(GUI.Button(new Rect(115,Screen.height-25,50,20),"Green")){
// SlideTo(greenPosition);
// }
// if(GUI.Button(new Rect(115,Screen.height-25,50,20),"Purple")){
// SlideTo(purplePosition);
// }
//}
function OnDrawGizmos(){
iTween.DrawPath(movePath,Color.magenta);
iTween.DrawPath(lookPath,Color.cyan);
Gizmos.color=Color.black;
Gizmos.DrawLine(transform.position,lookTarget.position);
}
function SlideTo(position : float){
iTween.Stop(gameObject);
iTween.ValueTo(gameObject,iTween.Hash("from",percentage,"to",position,"time",2,"easetype",iTween.EaseType.easeInOutCubic,"onupdate","SlidePercentage"));
}
function SlidePercentage(p : float){
percentage=p;
}
~be
Comment
I tried replacing the OnGUI with OnTouch and the Percentage... to no avail