Hi everyone,
I am trying to have an animaed texture.
- By clicking Mouse0, texture should appear from height 0 to 100% in X seconds.
- by clicking Mouse0 again, texture disappears
- by clicking Mouse0 again , the texture should appear from height 0 to 100% in X seconds.
- …
I tried several things like creating another script with a Mathf.Lerp. It was working but I couldnt reinit the function…
Anyway; if someone has a suggestion, please let e know.
Thanks in advance
I have actually one way to do it, but its not the cleanest way ever.
Here is the script, maybe someone knows a way to improve it:
private var animationStart = 0.00;
function OnGUI ()
{
switch (menuState)
{
case 1:
if(Input.GetKey (KeyCode.Mouse0))
{
animationStart= Time.time;
menuState = 2;
}
break;
case 2:
if (animationStart + 0.3 < Time.time)
GUI.Label ( Rect((Screen.width/2 - menuNoSelected3.width/2),(Screen.height/2),menuNoSelected3.width, menuNoSelected3.height),menuNoSelected3);
else if (animationStart + 0.2 < Time.time)
GUI.Label ( Rect((Screen.width/2 - menuNoSelected2.width/2),(Screen.height/2),menuNoSelected2.width, menuNoSelected2.height),menuNoSelected2);
else if (animationStart + 0.1 < Time.time)
GUI.Label ( Rect((Screen.width/2 - menuNoSelected1.width/2),(Screen.height/2),menuNoSelected1.width, menuNoSelected1.height),menuNoSelected1);