The foundation of animation in Angular is using transitions to move from one state to another state. Transitions bring in the concept of time and how long it should take to go from one state to the next while they almost magically calculate the difference in values over time between the CSS properties of each state.
Now, we can make a second button here. We'll call this onStopClick(), call this stop. Create a method called onStopClick() and this .signal = stop. Now we'll have a go, stop, go, stop button. What we can do between these two states is we can define what's called a transition between the states.
The way we define this transition is with a string that represents the from and it moves to the to. We're saying from any state and moving to any state. We want to animate for 500 milliseconds. Hit save and you'll see we go from Go to Stop, Go to Stop, and it's smoothly animating between red and green. I can even add in more properties here, like height 100 pixels, height 50 pixels.
Now when it starts, you'll see it goes from nothing to Stop, and then Go, and Stop and Go, and smoothly animating between those states and properties.