If I have started an animation with Angular, how can I stop it before it is finished?
I could need to stop an animation for example if I have an animation when a user clicks on something. And if the user clicks again before the animation is finished, I would like to stop it and restart it.
For example, the Angular docs have this animation:
animations: [
trigger('heroState', [
state('inactive', style({
backgroundColor: '#eee',
transform: 'scale(1)'
})),
state('active', style({
backgroundColor: '#cfd8dc',
transform: 'scale(1.1)'
})),
transition('inactive => active', animate('100ms ease-in')),
transition('active => inactive', animate('100ms ease-out'))
])
]
So, if the animation is triggered, how can I stop it before it is completed?