animation-utils.js 422 B

1234567891011121314
  1. function waitForIterationChange(animation) {
  2. var initialIteration = animation.effect.getComputedTiming().currentIteration;
  3. return new Promise(resolve => {
  4. window.requestAnimationFrame(handleFrame = () => {
  5. if (animation.effect.getComputedTiming().currentIteration !=
  6. initialIteration) {
  7. resolve();
  8. } else {
  9. window.requestAnimationFrame(handleFrame);
  10. }
  11. });
  12. });
  13. }