How to animate a UI panel?

I am trying to have a tongue from my character shoot out when you are on an option (say if you are on start, not clicking just highlighting, it will play the animation of the tongue going to the option once and stay there and when you unhighlight it plays the animation backwards) I also have another character with a tongue that will go to the other option if it is highlighted and do the same as above. I have tried using the animator (maybe I am not using it right)

  • Click the panel, add animation component.

  • Ctrl+6 or Window - Animation to pop up animation tab and dock wherever you want.

  • In the empty animation tab there’ll be a message with a button to let you create a clip, press create. a window will pop up, type a name maybe “TongueOut” and choose where to save and confirm.

  • Press “Add Property”, choose someone you need it’s value changed, or just changing them in the inspector and the properties will automatically fills in. and you want to mess with the key frames & timeline a little bit. basically some typical animation editing work, just like any other animation-editing-software.

  • When you done your “TongueOut”. maybe you need another “TongueIn”, then you’ll need to find the red recording button in the animation tab,and press the TongueOut double arrow button below. and choose Create new clip.

  • When all done, set Animations Size = 2 in the inspector , and drag those two clips in.

  • Get that animation component reference somewhere in your script and play them when you need it. something like this: @kalley51

    Panel panel_Foo;
    Animation anim_Foo ;

    void OnEnable()
    {
    panel_Foo = GameObject.FindGameObjectWithTag(“panelFoo”);
    anim_Foo = panel_Foo.GetComponent ();
    }

    void TongueOut()
    {
    anim_Foo.Play(“TongueOut”);
    }

    void TongueIn()
    {
    anim_Foo.Play(“TongueIn”);
    }