Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to listen to animation end event #36

Closed
SuneethaYamani opened this issue Sep 5, 2019 · 1 comment
Closed

How to listen to animation end event #36

SuneethaYamani opened this issue Sep 5, 2019 · 1 comment

Comments

@SuneethaYamani
Copy link

How to detect animation end event and enable another animation in sequence

@filipows
Copy link
Owner

filipows commented Sep 6, 2019

Hi @SuneethaYamani ,

We have 2 callback methods for each animation in Angular: start and done which are being triggered at the beginning and at the end of animation respectively. It will look like that:

<div 
    [@bounce]="animationState" 
    (@bounce.start)="animStart()" 
    (@bounce.done)="animEnd()">
</div>

and in your component:

  animate() {
    this.animationState = !this.animationState;
  }

  animStart() {
    console.log('Animation Started');
  }

  animEnd() {
    console.log('Animation Ended');
  }

So you could use done callback to trigger another animation in your case.

Here's an example on Stackblitz I've created for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants