The Script is at the bottom

Select the object you want to animate
Go to the animation tab and click “create”

Please actually name your animation, to what it is specifically doing

Add a property to start animating the object

If you want to move your object up and down you will need to select Transform→ Position
If you want to rotate your object, you will need to select Transform→ Rotate
You can also change your game objects material through animation (has to have a material on your object in order to do this. MeshRenderer→Color or Base Color
Make sure to open up the property to change the color values

When you Add Property it will create key frames at the start and end of the animation
Lets say you make a Transform Position property, the keyframes will be the current position of the game object. So if your game object is at 3, 3, 3 then the keyframes is storing 3, 3, 3 at the start and end of the animation.
Choose a spot in the animation timeline where you want to change the animation (i usually choose the middle). You can add key frames by:

Changing the position of the game object in the inspector (left hand size) and then right click in the timeline→add key frames

Hitting Record Button and then moving the game object (records the game objects change in position)
Or changing the values in the left hand side of the animation and they right clicking “add key”
This way makes your game object play when you start the game
But what if you only want to play the animation on a trigger?
When you create an animation it creates two things, an Animator Controller and an Animation Clip, the clips are the actual animation, the controller controls the conditions for the animation to play. You can have multiple animation clips in one Controller
As of right now when you make an animation, it automatically plays. Entry means start, and entry is connected to our animation clip

We need to disconnect entry from our animation clip, and create a blank state. So on start our animation moves to the blank state (nothing plays)
Right click inside the animator→ create state→ empty

Right click Entry and hit “Make transition”
