I am using the Sprite Library and Sprite Resolver to animate my sprites.
This allows me to use the same animation with others that share the same set up, i.e. 3 Frame Idle animation I can use the same, I just use the same Category with the same set up and presto the sprites are all different.
You Create the Animation the same way as you create any other animation using the Animator. You select the Game Object that has the Animator assigned, in the Animation Panel you select the Animation you want to Edit (or create a new one). Press the Record button. Select the frame that you want to edit, find the Sprite Resolver Component, select the Category and the Label that you want to use. Change to your next frame, you can change the Label, or the Category and label. Repete for each sprite you want to be in the animation, in my case for the idle animation I only have 2 sprites, Frame 1 will be the first sprite, Frame 2 will be the second sprite. I have found that the animation works better if you add a frame at the end that has the same keys as the first frame.
As an example I have a Main Sprite Library Asset that has 2 sprites for Idle and 8 sprites for run.
I then have A Sprite Library Asset for each NPC that uses this The Main Sprite Library.
I then have a Animator Controller that has just an Idle animation that cycles between the idle frames of the resolver. I also have an IdleRun Animation controller that uses the same Idle animation but also has a running animation that cycles through the Running Category.
The Player uses the Idle Run Animator Controller.
I have a NPC Prefab that uses the Idle Only Controller, with the Main Library set as the Library.
I also have NPC Variant Prefabs that use the NPC Library for that NPC, the animator is the same and the animation is the same but the sprites are different.
To Create a new NPC I use the NPC Prefab, Select the Asset I want to use for that NPC, when the animation plays it plays the correct animation
I highly recommend using the Sprite Library / Sprite Resolver in your 2D projects as it makes life a million times easier when you are doing sprite base animations especially when you have several different variations of the same sprite. Like my Player and NPCS all have the same Idle animation they just have different sprites. You only have to create the animation once, and the Sprite Resolver does all the heavy lifting behind the scenes to use different sprites for your different characters.