# How do I animate Unity GUIComponents?

I want to transform my GUIWindow from the bottom of the screen to the middle whenever the user presses a button. How can I do this?

Using isGuiUp to store a state (location of GUI), then an if statement to determine the proper location of the GUI.

Add the following to the Update() funciton of your gui controller script.

bool isGuiUp = false;

if (Input.GetKeyUp(KeyCode.Escape))
{
isGuiUp = !isGuiUp; //toggle the state
}

if (isGuiUp == true)
{
//code to move the gui to the middle of the screen
}
else
}
//code to move the gui to the bottom of the screen
}

• Well Thanks But I found the answer. In fact, I was not asking about logic as It is straighforward. I was asking for some Inbuit feature. I used LeanTween to achieve this. Thanks :) – Adnan Nazir May 1 '14 at 6:13
• Then please answer your own question with what you learned and help the community. Please don't take the time to ask questions if you aren't also willing to take the time to answer your own questions when you solve it yourself. – badweasel Feb 26 '15 at 5:13
• ok sure badweasel ! I'll for sure, take super care from now on. – Adnan Nazir Feb 2 '16 at 9:30