Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

449
Views
Angular, ¿cómo detectas cuándo termina una animación?

Estoy tratando de detectar cuándo finaliza una animación para poder ejecutar algo después, mi investigación me ha llevado a @animation.done y @animation.start pero parece dispararse al principio, independientemente de si mi animación está terminada.

Consolé un mensaje en mi función @animation.done y se activa al principio, incluso antes de que ocurra la animación, creo.

https://stackblitz.com/edit/angular-vtuydu?file=src/app/app.component.ts

HTML:

 <button type="button" class="button-viewproject" [@fadeInUpViewProject]="viewProjectState ? 'in' : 'out'" (@fadeInUpViewProject.done)="animationDone($event)" > View Me </button>

TS:

 animationDone(event: any) { console.log(this.viewProjectState); // alert('hey'); Seems to execute no matter what // alert('hey'); Seems to execute no matter what setTimeout(() => {}, 1900); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si observa el objeto AnimationEvent pasado a su método animationDone() , verá que el método se llama dos veces: una vez para pasar del estado 'void' al estado 'out' , luego una segunda vez para pasar del estado 'out' para decir 'in' :

Llamada #1 evento:

 { "element": {}, "triggerName": "fadeInUpViewProject", "fromState": "void", <---------------- "toState": "out", <------------------- "phaseName": "done", "totalTime": 0, "disabled": false, "_data": 1 }

Llamada #2 evento:

 { "element": {}, "triggerName": "fadeInUpViewProject", "fromState": "out", <----------------- "toState": "in", <-------------------- "phaseName": "done", "totalTime": 2000, "disabled": false, "_data": 3 }

El segundo evento es el que ocurre cuando la animación de toState realmente se completa (porque alcanzó su state final de 'in' ), por lo que en su método animationDone() , puede verificar el estado del objeto de evento pasado. propiedad está 'in' , entonces sabes que tu animación está completa.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!