x


Any fade-in/fade-out animations for GUI Text?

I have a scene going where the GUI Texts get instantiated at different times. But when you play it, it looks way to rapid. How can I add a fade-in animation to make it smoother?

more ▼

asked Oct 29 '10 at 05:51 AM

MikezNesh gravatar image

MikezNesh
843 64 74 93

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
more ▼

answered Oct 29 '10 at 06:19 AM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

(comments are locked)
10|3000 characters needed characters left

//I used four Images 1 and four are same image , AlphaValues are float

var mainMenuTex :Texture[];

var menuIndex:int = 0;

         if(menuIndex ==0)
             alphaValue -= Mathf.Clamp01(Time.deltaTime/10); 
       else if(menuIndex ==1)
             alphaValue1 -= Mathf.Clamp01(Time.deltaTime/10); 
       else if(menuIndex ==2)
             alphaValue2 -= Mathf.Clamp01(Time.deltaTime/10); 

       if(alphaValue <0 && menuIndex == 0)
         {
            menuIndex ++;
            alphaValue = 0;

            }
       else if(alphaValue1 < 0 && menuIndex == 1)
         {
            menuIndex ++;
            alphaValue1 = 0;

            }  
       else if(alphaValue2 < 0 && menuIndex == 2)
         {
            menuIndex   = 0;
            alphaValue  = 1.0f;
                 alphaValue1 = 1.0f;
                 alphaValue2 = 1.0f;    
            }     
        Debug.Log("alphaValue"+alphaValue);

           GUI.color.a = 1.0 ;
           GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), mainMenuTex[3],ScaleMode.StretchToFill, true, 0.0F);

           GUI.color.a = alphaValue2 ;  
           GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), mainMenuTex[2],ScaleMode.StretchToFill, true, 0.0F);

           GUI.color.a = alphaValue1 ;           
        GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), mainMenuTex[1],ScaleMode.StretchToFill, true, 0.0F);

           GUI.color.a = alphaValue ; 
        GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), mainMenuTex[0],ScaleMode.StretchToFill, true, 0.0F);

        GUI.color.a = 1.0 ;
more ▼

answered Feb 20 at 05:26 AM

suresh2485 gravatar image

suresh2485
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3811
x568
x194
x30

asked: Oct 29 '10 at 05:51 AM

Seen: 6985 times

Last Updated: Feb 20 at 05:26 AM