From eb57cc04f462177b98a23bf195514f6b5e60511a Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Tue, 18 Jul 2023 22:44:03 -0400 Subject: [PATCH] Add terminal effect --- data/index.json | 13 +++++++++++ layouts/index.html | 14 ++++++++++++ static/css/background.css | 7 ++++-- static/css/footer.css | 2 +- static/css/styles.css | 35 +++++++++++++++++++++++++++++- themes/clortox/static/js/script.js | 29 +++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 data/index.json diff --git a/data/index.json b/data/index.json new file mode 100644 index 0000000..f882fe7 --- /dev/null +++ b/data/index.json @@ -0,0 +1,13 @@ +{ + "Hobbies": [ + { + "value": "Software Architecture" + }, + { + "value": "Front End Development" + }, + { + "value": "Back End Development" + } + ] +} diff --git a/layouts/index.html b/layouts/index.html index defcefa..3dc9d49 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,4 +4,18 @@ {{ .Content }} +
+

~ $ 

+
+
+

Software developer with a passion for literally just about + everything.

+

Aspiring postmath; Jack of all trades, master of few.

+

Full stack developer at Etactics Inc.

+
+
+

~ $ 

+
+
+
{{ end }} diff --git a/static/css/background.css b/static/css/background.css index 9c4a0b3..09ec94b 100644 --- a/static/css/background.css +++ b/static/css/background.css @@ -1,13 +1,16 @@ .background { background-image: url("/img/webb-dark.png"); position: absolute; + top: 0; + bottom: 0; + left: 0; width: 100%; - height: 100%; + height: 150%; + overflow-y: hidden; z-index: -1; background-position: center; background-repeat: repeat; - background-attachment: auto; } diff --git a/static/css/footer.css b/static/css/footer.css index 3afd724..6d1c292 100644 --- a/static/css/footer.css +++ b/static/css/footer.css @@ -1,7 +1,7 @@ /* Footer */ footer { - background-color: rgba(11,11,11,0.9); + background-color: rgba(11,11,11,1); color: white; padding: 15px; text-align: center; diff --git a/static/css/styles.css b/static/css/styles.css index aa5f8f5..02263fa 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -9,6 +9,11 @@ font-display: swap; } +@keyframes blink-caret { + from, to { border-color: transparent } + 50% { border-color: white } +} + body { overflow-x: hidden; margin: 0; @@ -52,7 +57,7 @@ html { } .top-fade { - background: linear-gradient(rgba(11,11,12,1) 0%, rgba(11,11,12,0.9) 30%, rgba(0,0,0,0.1) 100%) + background: linear-gradient(rgba(11,11,12,1) 0%, rgba(11,11,12,0.9) 30%, rgba(0,0,0,0.0001) 100%) } .dashed-bottom { @@ -69,7 +74,35 @@ html { top: 50%; left: 50%; transform: translate(-50%, -50%); +} +.typewriter { + animation: blink-caret .75s step-end infinite; + border-right: .15em solid white; + display: inline; + +} + +.homepage-card { + height: calc(100vh - 6vh); + width: calc(100vw - 6vw); + padding: 1vh 1vw; + padding-top: 2vh; + background-color: rgba(11,11,12,0.4); + corner-radius: 10px; + margin: 2vh 2vw; +} + +.about-grid { + display: grid; + grid-template-columns: 65% 1fr; + +} + +.hobbies { + background-color: black; + height: 100%; + padding: 10px; } .page-header { diff --git a/themes/clortox/static/js/script.js b/themes/clortox/static/js/script.js index 28d713b..7d0d4af 100644 --- a/themes/clortox/static/js/script.js +++ b/themes/clortox/static/js/script.js @@ -1,4 +1,5 @@ const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +const typeWriterSpeed = 60; window.onload = function() { document.querySelectorAll(".scramble").forEach(item => { @@ -11,6 +12,13 @@ window.onload = function() { parallax.style.transform = 'translateY(' + scrollPosition * .5 + 'px)'; }) + document.querySelectorAll(".typewriter").forEach(item => { + observer.observe(item); + }); +} + +function sleep(milliseconds) { + return new Promise(resolve => setTimeout(resolve, milliseconds)); } function scramble(event){ @@ -39,4 +47,25 @@ function scrambleLetters(element) { }, 30); } +async function typeWriter(element) { + let typeWriterText = element.getAttribute("data-value"); + let output = element.innerText; + for(let i = 0; i < typeWriterText.length; ++i){ + output += typeWriterText.charAt(i); + // sleep for typeWriterSpeed milliseconds + await sleep(typeWriterSpeed); + element.innerText = output; + } + +} + +let observer = new IntersectionObserver(function(entries) { + for (let entry of entries){ + // If the element is visible, start the animation + if(entry.isIntersecting) { + typeWriter(entry.target); + observer.unobserve(entry.target); + } + } +}, { threshold: 0.7 });