Skip to content

Instantly share code, notes, and snippets.

@MohamedRajabMohammed
Created July 22, 2020 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MohamedRajabMohammed/c9929e9e81f31d167456f683bd35a688 to your computer and use it in GitHub Desktop.
Save MohamedRajabMohammed/c9929e9e81f31d167456f683bd35a688 to your computer and use it in GitHub Desktop.
// 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