Optimized listener events
This commit is contained in:
parent
210eca6fa1
commit
5936575888
2 changed files with 10 additions and 8 deletions
|
|
@ -3,12 +3,12 @@ const configs = (function () {
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
const enableLimit = true; // true or false
|
const enableLimit = true; // true or false
|
||||||
const limit = 10; // integer
|
const limit = 5; // integer
|
||||||
|
|
||||||
// animation
|
// animation
|
||||||
const scrollSpeed = 30; // milliseconds (DO NOT PUT BELOW 5, COMPUTER MIGHT CRASH) the lower the value, the faster the scroll
|
const scrollSpeed = 30; // milliseconds
|
||||||
const pauseBetweenScrolls = 2000; // milliseconds
|
const pauseBetweenScrolls = 2000; // milliseconds
|
||||||
const gapBetweenScrolls = "100px"; // px
|
const gapBetweenScrolls = "50px"; // px
|
||||||
|
|
||||||
// STYLES
|
// STYLES
|
||||||
// task list
|
// task list
|
||||||
|
|
|
||||||
|
|
@ -857,7 +857,12 @@ async function checkToAnimate() {
|
||||||
document.querySelector(".secondary").style.display = "none";
|
document.querySelector(".secondary").style.display = "none";
|
||||||
|
|
||||||
// cancel animations
|
// cancel animations
|
||||||
cancelAnimation();
|
if (primaryAnimation) {
|
||||||
|
primaryAnimation.cancel();
|
||||||
|
}
|
||||||
|
if (secondaryAnimation) {
|
||||||
|
secondaryAnimation.cancel();
|
||||||
|
}
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -867,10 +872,6 @@ function addAnimationListeners() {
|
||||||
primaryAnimation.addEventListener("finish", animationFinished);
|
primaryAnimation.addEventListener("finish", animationFinished);
|
||||||
primaryAnimation.addEventListener("cancel", animationFinished);
|
primaryAnimation.addEventListener("cancel", animationFinished);
|
||||||
}
|
}
|
||||||
if (secondaryAnimation) {
|
|
||||||
secondaryAnimation.addEventListener("finish", animationFinished);
|
|
||||||
secondaryAnimation.addEventListener("cancel", animationFinished);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function animationFinished() {
|
function animationFinished() {
|
||||||
|
|
@ -887,6 +888,7 @@ function cancelAnimation() {
|
||||||
secondaryAnimation.cancel();
|
secondaryAnimation.cancel();
|
||||||
}
|
}
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
|
console.log("animation cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue