I want to make three buttons to appear slowly,can anybody tell me?
using UnityEngine;
using System.Collections;
public class Test3 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
Rect button=new Rect(100,100,100,100);
Rect from=new Rect(100,100,100,100);
bool isShow=true;
Rect to =new Rect(25,30,250,30);
void OnGUI(){
GUI.BeginGroup(new Rect(20,20,300,300));
ChangePosition();
if(!isShow)
ShowMenu();
GUI.Box(new Rect(0,0,300,300)," ");
GUI.EndGroup();
}
void function(Rect r){
button=r;
}
Color colorfrom=new Color(1,1,1,0);
Color colorto=new Color(1,1,1,1);
void ShowMenu(){
GUI.BeginGroup(new Rect(50,70,250,200));
GUILayout.BeginVertical(GUILayout.Width(250),GUILayout.Height(200));
GUILayout.Button("button1",GUILayout.Width(200),GUILayout.Height(30));
GUILayout.Button("button2",GUILayout.Width(200),GUILayout.Height(30));
GUILayout.Button("button3",GUILayout.Width(200),GUILayout.Height(30));
GUILayout.EndVertical();
GUI.EndGroup();
}
void ChangePosition(){
if(GUI.Button(button,"Menu")){
if(isShow){
iTween.ValueTo(gameObject.gameObject,iTween.Hash("from",button,"to",to,"easeType",iTween.EaseType.easeInOutBack,"onupdate","function"));
}
else
{
iTween.ValueTo(this.gameObject,iTween.Hash("from",button,"to",from,"easeType",iTween.EaseType.easeInOutBack,"onupdate","function"));
}
isShow=!isShow;
}
}
void ChangeColor(Color c){
colorfrom=c;
}
}