main menu animation

what i want to happen is when you click the play button, an animation will play and when its done the frist level will load. if you could script that in java script that would be great!


It might look something like this (untested)

function OnGUI () {
    if (GUI.Button (Rect (10,10,150,100), "olay"))
        yield WaitForSeconds (5); // wait til animation done (probably not a good idea)

You might need to use a coroutine to do the animation and load next level. You might want the animation to have an event that fires to tell you it's done so you know when to load the next level.