Proper way to play non looping animations

I animated a character driving a boat with an idle, drive, throttle down animation. The throttle down animation should play once when the s key is pressed, then play the drive animation once. What’s happening is the throttle down keeps playing in a loop while the s key is down. I chose Once for the Wrapmode on throttle down, and loop for drive. Below is my code:

    function Update () {
	if(Input.GetKey(KeyCode.W)){
animation.Play("drive");
	
}else if(Input.GetKey(KeyCode.S) ){
	animation.Play("throttledown");
}
if(!Input.GetAxis("Horizontal") && !Input.GetAxis("Vertical")){
animation.CrossFade("idle");}
}

GetKey is the “key is being held down” check, so this code should play throttleDown over and over. Play is smart enough not to restart, but as soon as it ends, the key being held starts it again. GetKeyDown is the “once/press” check.

Also, Play usually gives some jerks at the start/stop. Often CrossFade("throttleDown",0.05); looks nicer (fades in/out over 1/20th of a second, which is about 3 frames.)

A trick for “idle” is to put in on a lower layer and leave it always playing. That way you can ignore it, and have it automatically be playing if nothing else is.

function Update () {
if(Input.GetKey(KeyCode.W)){
animation.Play(“drive”);

}else if(Input.GetKeyDown(KeyCode.S) ){
    animation.Play("throttledown");
}
if(!Input.GetAxis("Horizontal") && !Input.GetAxis("Vertical")){
animation.CrossFade("idle");}
}