Reverse animation

I need a little help with my script. i have a problem if the animation is on the last frame and i will stop pressing the button, the animation just stop and going to first frame too fast, but if i stop pressing button in the middle of animation then it will be smoothly back animation.
And this is animation for wings of my plane.

using UnityEngine;
using System.Collections;

public class Animacje : MonoBehaviour {
	
	void Start () {
	
	}
	
	void Update () {
		
		
		if(Input.GetKeyDown("s"))
		{
			
			
			animation["S"].speed = 1;
			animation["S"].wrapMode = WrapMode.Once;
			animation.Play("S");
			
			
			
			
			
			print("+1");
		}
		
		
		if(Input.GetKeyUp("s"))
		{
			
			
			animation["S"].speed = -1;
			animation.Play("S");
			
			print("-1");
		}
		
	}
		}

i think, you can do change the value “AnimationState.speed” 1.0f to 0.0f linearly.

Just increase the frame size
IF LAST FRAME = 10 THEN
SET IT AS 20 OR 25

from animation window
AND U WANT TO PLAY REVESE THEN JUST place ending Keyframe to starting point and vice versa

There are one or two things you can try here…

  1. Try it with animation.Crossfade. Think that will smooth out your results better, but I think your problem is the next point…
  2. It sounds like youre animating wing flaps or something? So I assume you are trying to animate them to their maximum pitch. So you probably want them to animate to the end of their clip and stop. So, set the looping mode to ClampForever
animation.wrapMode = WrapMode.ClampForever;