Skip to content

Commit 141be50

Browse files
committed
Add animation
1 parent 1d8fe62 commit 141be50

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

pages/index.html

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
font-weight: 300;
7373
}
7474

75+
.terminal-animation {
76+
margin: 2rem auto;
77+
max-width: 400px;
78+
width: 100%;
79+
}
80+
7581
.coming-soon {
7682
background-color: var(--bg-accent);
7783
border: 1px solid var(--card-border);
@@ -244,6 +250,26 @@
244250
<header>
245251
<h1>MCP</h1>
246252
<div class="tagline">Model Context Protocol Management Tool</div>
253+
<div class="terminal-animation">
254+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 100">
255+
<!-- Terminal background -->
256+
<rect x="10" y="10" width="280" height="80" rx="5" ry="5" fill="#2E3440" />
257+
258+
<!-- Static command prompt -->
259+
<text x="30" y="55" font-family="monospace" font-size="24" fill="#D8DEE9">$</text>
260+
<text x="55" y="55" font-family="monospace" font-size="24" fill="#88C0D0">mcpm</text>
261+
262+
<!-- Animated command text -->
263+
<text id="commandText" x="130" y="55" font-family="monospace" font-size="24" fill="#88C0D0"></text>
264+
265+
<!-- Cursor -->
266+
<rect id="cursor" x="130" y="40" width="2" height="24" fill="#D8DEE9">
267+
<animate attributeName="opacity" values="1;0;1" dur="0.8s" repeatCount="indefinite" />
268+
</rect>
269+
270+
<!-- No script here - moved to document scripts -->
271+
</svg>
272+
</div>
247273
</header>
248274

249275
<div class="coming-soon">
@@ -369,6 +395,71 @@ <h2>Supported Clients</h2>
369395
}, 2000);
370396
});
371397
});
398+
399+
// Terminal animation script
400+
const commandText = document.getElementById('commandText');
401+
const cursor = document.getElementById('cursor');
402+
403+
if (commandText && cursor) {
404+
// Commands to type
405+
const commands = [" search", " install", " list"];
406+
let currentCommand = 0;
407+
let charIndex = 0;
408+
let isTyping = true;
409+
const typingSpeed = 200;
410+
const deleteSpeed = 150;
411+
const pauseDuration = 1000;
412+
413+
function updateCursor() {
414+
// Position cursor after the text
415+
if (commandText.getComputedTextLength) {
416+
cursor.setAttribute('x', 130 + commandText.getComputedTextLength());
417+
}
418+
}
419+
420+
function animateText() {
421+
const cmd = commands[currentCommand];
422+
423+
if (isTyping) {
424+
// Typing forward
425+
charIndex++;
426+
commandText.textContent = cmd.substring(0, charIndex);
427+
428+
if (charIndex >= cmd.length) {
429+
// Reached end of command, pause then start deleting
430+
isTyping = false;
431+
charIndex = cmd.length;
432+
setTimeout(animateText, pauseDuration);
433+
return;
434+
}
435+
436+
setTimeout(animateText, typingSpeed);
437+
} else {
438+
// Deleting backward
439+
charIndex--;
440+
commandText.textContent = cmd.substring(0, charIndex);
441+
442+
if (charIndex <= 0) {
443+
// Finished deleting, move to next command
444+
isTyping = true;
445+
charIndex = 0;
446+
currentCommand = (currentCommand + 1) % commands.length;
447+
setTimeout(animateText, typingSpeed);
448+
return;
449+
}
450+
451+
setTimeout(animateText, deleteSpeed);
452+
}
453+
454+
updateCursor();
455+
}
456+
457+
// Start animation
458+
animateText();
459+
460+
// Fix for SVG animation in some browsers
461+
setInterval(updateCursor, 100);
462+
}
372463
});
373464
</script>
374465
</body>

0 commit comments

Comments
 (0)