How do I change 2d animations?

I want my character to move similarly to Sonic the Hedgehog, where he starts with a jog, which then transitions to a running animation, and also has a top speed animation for when he exceeds the base speed limit. How would I change
from a walking to running animation, and how would I get the game to recognize my character moving past the base limit and play the animation? I’m using 2d sprites. Thanks in advance.