Last active
July 26, 2018 08:44
-
-
Save t1ger-0527/2187a09f7ecf068d4ff44a9a54f9bc85 to your computer and use it in GitHub Desktop.
Call something after multiple animation frame. So-called requestMultipleAnimationFrame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function requestMultipleAnimationFrame(cb, times) { | |
| if (times === 1) { | |
| return requestAnimationFrame(cb); | |
| } else { | |
| return requestAnimationFrame(() => { | |
| requestMultipleAnimationFrame(cb, times - 1); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment