evalstate HF Staff commited on
Commit
993ccca
·
verified ·
1 Parent(s): d0fc10b

Add slide-visibility control and improve panel sizing for stateful request animation

Browse files
2026/mcp-connect/animations/mcp-stateful-request.html CHANGED
@@ -19,9 +19,9 @@
19
  .api-window {
20
  background: linear-gradient(135deg, #1e1e1e 0%, #252526 100%);
21
  border-radius: 16px;
22
- padding: 20px;
23
- width: 480px;
24
- height: 460px;
25
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
26
  overflow: hidden;
27
  position: relative;
@@ -90,7 +90,7 @@
90
  bottom: 20px;
91
  left: 20px;
92
  right: 20px;
93
- padding: 12px;
94
  background: #2d2d3a;
95
  border-radius: 8px;
96
  font-size: 10px;
@@ -317,9 +317,13 @@
317
  schedule(() => runAnimation(activeRunId), totalTime + CYCLE_PAUSE);
318
  }
319
 
320
- function startAnimation() {
321
  runId++;
322
  clearTimers();
 
 
 
 
323
  schedule(() => runAnimation(runId), 500);
324
  }
325
 
@@ -336,7 +340,15 @@
336
  }
337
  });
338
 
339
- scaleCanvas();
 
 
 
 
 
 
 
 
340
  </script>
341
  </body>
342
  </html>
 
19
  .api-window {
20
  background: linear-gradient(135deg, #1e1e1e 0%, #252526 100%);
21
  border-radius: 16px;
22
+ padding: 14px;
23
+ width: min(96vw, 560px);
24
+ height: min(96vh, 560px);
25
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
26
  overflow: hidden;
27
  position: relative;
 
90
  bottom: 20px;
91
  left: 20px;
92
  right: 20px;
93
+ padding: 10px;
94
  background: #2d2d3a;
95
  border-radius: 8px;
96
  font-size: 10px;
 
317
  schedule(() => runAnimation(activeRunId), totalTime + CYCLE_PAUSE);
318
  }
319
 
320
+ function stopAnimation() {
321
  runId++;
322
  clearTimers();
323
+ }
324
+
325
+ function startAnimation() {
326
+ stopAnimation();
327
  schedule(() => runAnimation(runId), 500);
328
  }
329
 
 
340
  }
341
  });
342
 
343
+ // Parent-controlled visibility for embedded slide iframes.
344
+ window.addEventListener('message', (event) => {
345
+ const data = event.data;
346
+ if (!data || data.type !== 'marp-slide-visibility') return;
347
+ if (data.active) startAnimation();
348
+ else stopAnimation();
349
+ });
350
+
351
+ scaleCanvas({ maxScale: 1.25 });
352
  </script>
353
  </body>
354
  </html>