1 -Select the script in the hierarchy.
2 -Open the animation window, select the gameobject to animate, and click create.
3 -Click record and drag the sprite sequence. The speed of the animation can be controlled by the number of samples.
4 -Et voilà!
Animations are controlled further by the animator. In this case, it is a simple animation repeating on a loop. It is possible to just play once the animation by deselecting the loop in the inspector.