Spaces:
Running
Running
Keep sequence animations visible between cycles (avoid disappearing/blank states)
Browse files
animations/shared/sequence-helpers.js
CHANGED
|
@@ -6,6 +6,7 @@ function runSequenceAnimation({
|
|
| 6 |
lastDelayOverride,
|
| 7 |
onShow,
|
| 8 |
scrollContainerSelector,
|
|
|
|
| 9 |
} = {}) {
|
| 10 |
const groups = (selectors || []).flatMap((selector) =>
|
| 11 |
Array.from(document.querySelectorAll(selector))
|
|
@@ -67,15 +68,20 @@ function runSequenceAnimation({
|
|
| 67 |
}, delay);
|
| 68 |
});
|
| 69 |
|
| 70 |
-
|
| 71 |
-
schedule(() => {
|
| 72 |
-
if (activeRunId !== runId) {
|
| 73 |
-
return;
|
| 74 |
-
}
|
| 75 |
-
groups.forEach((el) => el.classList.add('fade-out'));
|
| 76 |
-
}, fadeOutTime);
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
function start() {
|
|
|
|
| 6 |
lastDelayOverride,
|
| 7 |
onShow,
|
| 8 |
scrollContainerSelector,
|
| 9 |
+
useFadeOut = false,
|
| 10 |
} = {}) {
|
| 11 |
const groups = (selectors || []).flatMap((selector) =>
|
| 12 |
Array.from(document.querySelectorAll(selector))
|
|
|
|
| 68 |
}, delay);
|
| 69 |
});
|
| 70 |
|
| 71 |
+
let restartDelay = finalDelay + cyclePause;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
if (useFadeOut) {
|
| 74 |
+
const fadeOutTime = finalDelay + fadeOutOffset;
|
| 75 |
+
schedule(() => {
|
| 76 |
+
if (activeRunId !== runId) {
|
| 77 |
+
return;
|
| 78 |
+
}
|
| 79 |
+
groups.forEach((el) => el.classList.add('fade-out'));
|
| 80 |
+
}, fadeOutTime);
|
| 81 |
+
restartDelay = fadeOutTime + 1000 + cyclePause;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
schedule(() => runAnimation(activeRunId), restartDelay);
|
| 85 |
}
|
| 86 |
|
| 87 |
function start() {
|