In this recipe, we'll use (in a simple way) 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 press Horizontal input axis values to a Parameter in the state chart, and which will drive the transition from one state to the other.
While it 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.