i need a help with script Animation Trigger

hi everyone i want to write a script but i don’t know how help me!
i want to do like this

  1. OntriggerEnter Start animation
  2. OnTriggerExit reverse animation
    how to do that in unity 5 thanks!

you need to make a animator .
and make animation .

after that add the animation to the animator …

and add animator to game object or ui … and put it enbeld = false.

in script :

  public Start()
    {
    animator an1;
    an1 = getcombonent<animator>();
    }
    
    public void OnTttiggerEnter (Coleder c1)
    {
    if (c1 . tag = "tag Object")
    {
    an1 . Enable = true;
    }

void OnTriggerExit(Coleder c1)
{
// here iam sorry i dont know how to reverse the animator .
}

    }