Jump to content
Search Community

AFoeee

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by AFoeee

  1. Hello!

    Is it intended that the Promise object, which is returned by a Tween's .then() method, isn't terminated when the animation has been overwritten?

     

    At first I planned on using it in combination with the async/await syntax, which sometimes resulted in a permanent halt of the respective function. (In my tests the status of the Promise remains "pending" after the animation has been overwritten.)

     

    But even when I use it with a then-catch-structure, no clause is executed.

     

    In the end I promisified the GSAP animations myself:

    // for example
    function hide(elmnt, duration = 0) {
      return new Promise((resolve, reject) => {
        gsap.to(elmnt, {
          duration: duration, 
          autoAlpha: 0, 
          overwrite: 'auto', 
          onComplete: resolve, 
          onInterrupt: reject
        });
      });
    }

     

    I feel like this undermines the usefulness of the .then() method (at least for some usecases).

     

    Have a good one!

    See the Pen GRyeZKV by AFoeee (@AFoeee) on CodePen

×
×
  • Create New...