Spaces:
Running
Running
Add slide visibility message control to sequence animations
Browse files
2026/mcp-connect/animations/shared/sequence-helpers.js
CHANGED
|
@@ -84,9 +84,13 @@ function runSequenceAnimation({
|
|
| 84 |
schedule(() => runAnimation(activeRunId), restartDelay);
|
| 85 |
}
|
| 86 |
|
| 87 |
-
function
|
| 88 |
runId++;
|
| 89 |
clearTimers();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
schedule(() => runAnimation(runId), initialDelay);
|
| 91 |
}
|
| 92 |
|
|
@@ -102,4 +106,18 @@ function runSequenceAnimation({
|
|
| 102 |
start();
|
| 103 |
}
|
| 104 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
}
|
|
|
|
| 84 |
schedule(() => runAnimation(activeRunId), restartDelay);
|
| 85 |
}
|
| 86 |
|
| 87 |
+
function stop() {
|
| 88 |
runId++;
|
| 89 |
clearTimers();
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
function start() {
|
| 93 |
+
stop();
|
| 94 |
schedule(() => runAnimation(runId), initialDelay);
|
| 95 |
}
|
| 96 |
|
|
|
|
| 106 |
start();
|
| 107 |
}
|
| 108 |
});
|
| 109 |
+
|
| 110 |
+
// Parent-controlled visibility for embedded slide iframes.
|
| 111 |
+
window.addEventListener('message', (event) => {
|
| 112 |
+
const data = event.data;
|
| 113 |
+
if (!data || data.type !== 'marp-slide-visibility') {
|
| 114 |
+
return;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
if (data.active) {
|
| 118 |
+
start();
|
| 119 |
+
} else {
|
| 120 |
+
stop();
|
| 121 |
+
}
|
| 122 |
+
});
|
| 123 |
}
|