In this recipe, we'll use the Unity animation system to create two states corresponding to two animation clips, and a script that changes localScale according to which animation state is active. We'll use a second script, which will map the arrow keys to the Horizontal input axis values as a Parameter in the state chart, which will drive the transition from one state to the other.
While this may seem like a lot of work, compared to the previous recipe, such an approach illustrates how we can map from input events (such as key presses or touch inputs) to parameters and triggers in a State Chart.