Created
July 22, 2020 00:06
-
-
Save MohamedRajabMohammed/c9929e9e81f31d167456f683bd35a688 to your computer and use it in GitHub Desktop.
This file contains 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
// create the interval that creates the timer | |
function createTimer() { | |
interval = setInterval(() => { | |
// 1. increment our count | |
count++; | |
// 2. calculate the offset and apply it | |
const offset = height * count; | |
// 3. apply the offset using css transforms | |
numbersArea.style.transform = `translateY(-${offset}px)` | |
// 4. stop the interval at 10 | |
if (count >= 10) { | |
// go to the next episode | |
clearInterval(interval); | |
} | |
}, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment