纳金网

标题: Unity3D创建GUI展开动画效果 [打印本页]

作者: star-小虎    时间: 2013-10-23 15:55
标题: Unity3D创建GUI展开动画效果
var show = false;var grow = false;var min = 0.0;var max = 50.0;var height = 0.0;var speed = 0.0;//var skin:GUISkin;function OnGUI (){//GUI.skin = skin;if(GUI.Button(Rect(5,5,104,25),"List")){   grow = true;   if(!show)   show = true;}if(show){   GUILayout.BeginArea(Rect(7,30,100,height),"","Box");   GUILayout.BeginVertical();   for(i = 0;i<18;i++)  GUILayout.Button(i+".Title");   GUILayout.EndVertical();  GUILayout.EndArea();}if(grow){   speed += Time.deltaTime*5.0;   height = Mathf.Lerp(min,max,speed);   if(Mathf.Approximately(height,max))   {    grow = false;    max = min;   min = height;    speed = 0.0;    if(min == 0)    show = false;   }}}

作者: huhumark    时间: 2013-10-26 21:51
可以用Shader作的,贴图动画
作者: huhumark    时间: 2013-12-14 11:45
很好用的哦
作者: hariboot    时间: 2013-12-14 11:59
代码很乱




欢迎光临 纳金网 (http://course.narkii.com/club/) Powered by Discuz! X2.5