From e48867187ecfdfcee5cbee13fbb95b59459fce57 Mon Sep 17 00:00:00 2001 From: Josh Patra <30350506+SoPat712@users.noreply.github.com> Date: Fri, 11 Apr 2025 16:58:44 -0400 Subject: [PATCH] cool effects --- src/routes/+page.svelte | 103 +++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 6114043..59404ac 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -68,7 +68,7 @@ "Collaborated closely with the open-source community", "Assisted in the deployment of a major desktop app release", ], - image: "\BlueBubbles.png", + image: "/BlueBubbles.png", }, { name: "Terminal Portfolio", @@ -213,10 +213,47 @@ /** @type {HTMLInputElement | null} */ let terminalInput = null; - onMount(() => { + // Variables for typewriter effect + let typedName = ""; + let typedRole = ""; + let bioVisible = false; // controls when the bio fades in + + // Typewriter function for the text + function typeWriter(text, setter, delay) { + return new Promise((resolve) => { + let i = 0; + const interval = setInterval(() => { + setter(text.slice(0, i + 1)); + i++; + if (i >= text.length) { + clearInterval(interval); + resolve(); + } + }, delay); + }); + } + + onMount(async () => { if (terminalInput) { terminalInput.focus(); } + // Faster typing speed: delay set to 50ms + await typeWriter( + profile.name, + (val) => { + typedName = val; + }, + 150, + ); + await typeWriter( + profile.role, + (val) => { + typedRole = val; + }, + 50, + ); + // Once typing is done, fade in the bio + bioVisible = true; }); function executeCommand() { @@ -226,7 +263,13 @@ const cmd = currentCommand.toLowerCase().trim(); if (cmd === "help") { - output = `Available commands:\n- help: Show this help\n- clear: Clear terminal\n- whoami: Display name\n- ls: List sections\n- cat [section]: View section (projects, education, achievements, experience, skills)\n- contact: Display contact info`; + output = `Available commands: +- help: Show this help +- clear: Clear terminal +- whoami: Display name +- ls: List sections +- cat [section]: View section (projects, education, achievements, experience, skills) +- contact: Display contact info`; } else if (cmd === "clear") { terminalHistory = []; currentCommand = ""; @@ -305,21 +348,12 @@ /** Opens user's default mail client with a prefilled message. */ function sendMail() { - // Subject can remain the same (or change it as you wish) const subject = `Portfolio Contact from ${userName}`; - - // Updated body to put name/email on one line, then a blank line, then the message const body = `Name: ${userName}, Email: ${userEmail}\n\n${userMessage}`; - - // Construct the mailto link const mailtoUrl = `mailto:joshpatra12@gmail.com?subject=${encodeURIComponent( subject, )}&body=${encodeURIComponent(body)}`; - - // Open the mail client window.location.href = mailtoUrl; - - // Clear form fields if desired userName = ""; userEmail = ""; userMessage = ""; @@ -346,7 +380,6 @@