Pages
    • GETTING STARTED
        • API REFERENCE
                                                                                                                                              • COMMAND LINE
                                                                                                                                                  On this page

                                                                                                                                                      .progress()

                                                                                                                                                      The animation.progress() method.

                                                                                                                                                      This Animation instance method is used to get the percentage progress of an animation.

                                                                                                                                                      Syntax

                                                                                                                                                      let progress = animation.progress();

                                                                                                                                                      Return

                                                                                                                                                      • progress: Number - A number between 0 and 1, representing 0% and 100% respectively, of the animation's total timing. Here the total timing is calculated as delay + duration + endDelay.

                                                                                                                                                      Usage

                                                                                                                                                      Get the progress of an animation at 350ms.

                                                                                                                                                      let animation = new Animation(el, [{
                                                                                                                                                          opacity:1,
                                                                                                                                                      }, {
                                                                                                                                                          opacity:0,
                                                                                                                                                      }], {
                                                                                                                                                          delay: 100, 
                                                                                                                                                          duration:600,
                                                                                                                                                      });
                                                                                                                                                      
                                                                                                                                                      setTimeout(() => {
                                                                                                                                                          console.log(animation.progress()); // About 0.5
                                                                                                                                                      }, 350);