This example will show how to make and use animation clips for game objects or players.
Note, the models used in this example are downloaded from Unity Asset Store. The player was downloaded from the following link: https://www.assetstore.unity3d.com/en/#!/content/21874.
To create animations, first open the Animation Window. You can open it by clicking on Window and Select Animation or press Ctrl+6. The select the game object to which you want to apply the animation clip, from the Hierarchy Window, and then click on Create button on the Animation Window.
Name your animation (like IdlePlayer, SprintPlayer, DyingPlayer etc.) and Save it. Now, from the Animation Window, click on Add Property button. This will allow you to change the property of the game object or player with respect to time. This can include Tranforms like rotation, position and scale and anyother property that is attached to the game object e.g. Collider, Mesh Renderer etc.
To create a running animation for game object, you will need a humanoid 3D model. You can download the model from the above link. Follow the above steps to create a new animation. Add a Transform property and select Rotation for one of the character leg.
At this moment, your Play button and Rotation values in the game object property would have turned red. Click the drop down arrow to see the rotation X, Y and Z values. The default animation time is set to 1 second. Animations use key frames to interpolate between values. To animate, add keys at different points in time and change the rotation values from the Inspector Window. For e.g. the rotation value at time 0.0s can be 0.0. At time 0.5s the value can be 20.0 for X. At time 1.0s the value can be 0.0. We can end our animation at 1.0s.
Your animation length depends on the last Keys that you add to the Animation. You can add more keys to make the interpolation smoother.