How can I activate an animation? (Javascript)

I want to activate two animations, but don’t know how to do it. My script has two variable animation clips like this:

var ElevatorDoor : AnimationClip;
var Elevator : AnimationClip;

I just need the line to activate those, because I already have set up everything else

Here’s the whole code if it helps:

#pragma strict
@script RequireComponent( AudioSource )
 
var distanceToElevatorButton : float = 2.5;

var ElevatorDoor : AnimationClip;
var Elevator : AnimationClip;
 
 
function Start()
{
    Screen.lockCursor = true;
 
}
 
 
function Update()
{
    if ( Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.E) )
    {
       var ray = Camera.main.ScreenPointToRay( Vector3( Screen.width * 0.5, Screen.height * 0.5, 0.0 ) );
       var hit : RaycastHit;
       if ( Physics.Raycast( ray, hit, distanceToElevatorButton ) )
       {
         if ( hit.collider.gameObject.name == "ElevatorButton" )
         {
         	//This is where I want my animation to start...
         	 
          
          
         }
       }
    }
}

I hope you guys can help :smiley:

You mean you just need to play the clip? See the following links.

http://docs.unity3d.com/Documentation/ScriptReference/Animation.Play.html
http://docs.unity3d.com/Documentation/ScriptReference/Animation.html