]> git.ardis.lu - ard.is/commitdiff
Set final frame when RAF step exceeds final frame
authorArdis Lu <ardisglu@gmail.com>
Fri, 8 Sep 2023 03:30:06 +0000 (20:30 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 8 Sep 2023 03:30:06 +0000 (20:30 -0700)
RAF will pause if the tab is inactive, so this is needed to set the final frame if the user tabs away through the end of the animation.

index.html

index 4c326243fa0dad8946fb4bb00dd28ebf16dad72b..06cb2600ac14c86c730296d927fead5704d38752 100644 (file)
       }
       const currentFrame = Math.floor((timestamp - start) / msPerFrame);
       if (currentFrame >= frames.length) {
+        asciiContainer.textContent = ascii;
         return;
       }
       asciiContainer.textContent = frames[currentFrame];
This page took 0.040766 seconds and 4 git commands to generate.