A Pen by Hyperplexed on CodePen.
Created
February 20, 2023 12:42
-
-
Save marshyon/51f48bdd1e96049ab6192458e3b9a05a to your computer and use it in GitHub Desktop.
Hacked Text Effect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 data-value="HYPERPLEXED">HYPERPLEXED</h1> | |
<a id="source-link" class="meta-link" href="https://kprverse.com" target="_blank"> | |
<i class="fa-solid fa-link"></i> | |
<span>Source</span> | |
</a> | |
<a id="yt-link" class="meta-link" href="https://youtu.be/W5oawMJaXbU" target="_blank"> | |
<i class="fa-brands fa-youtube"></i> | |
<span>2 min tutorial</span> | |
</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
let interval = null; | |
document.querySelector("h1").onmouseover = event => { | |
let iteration = 0; | |
clearInterval(interval); | |
interval = setInterval(() => { | |
event.target.innerText = event.target.innerText | |
.split("") | |
.map((letter, index) => { | |
if(index < iteration) { | |
return event.target.dataset.value[index]; | |
} | |
return letters[Math.floor(Math.random() * 26)] | |
}) | |
.join(""); | |
if(iteration >= event.target.dataset.value.length){ | |
clearInterval(interval); | |
} | |
iteration += 1 / 3; | |
}, 30); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://kit.fontawesome.com/944eb371a4.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
display: grid; | |
place-items: center; | |
height: 100vh; | |
background-color: black; | |
margin: 0rem; | |
overflow: hidden; | |
} | |
h1 { | |
font-family: 'Space Mono', monospace; | |
font-size: clamp(3rem, 10vw, 10rem); | |
color: white; | |
padding: 0rem clamp(1rem, 2vw, 3rem); | |
border-radius: clamp(0.4rem, 0.75vw, 1rem); | |
} | |
h1:hover { | |
background-color: white; | |
color: black; | |
} | |
/* -- YouTube Link Styles -- */ | |
body.menu-toggled > .meta-link > span { | |
color: rgb(30, 30, 30); | |
} | |
#source-link { | |
bottom: 60px; | |
} | |
#source-link > i { | |
color: rgb(94, 106, 210); | |
} | |
#yt-link > i { | |
color: rgb(239, 83, 80); | |
} | |
.meta-link { | |
align-items: center; | |
backdrop-filter: blur(3px); | |
background-color: rgba(255, 255, 255, 0.05); | |
border: 1px solid rgba(255, 255, 255, 0.1); | |
border-radius: 6px; | |
bottom: 10px; | |
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1); | |
cursor: pointer; | |
display: inline-flex; | |
gap: 5px; | |
left: 10px; | |
padding: 10px 20px; | |
position: fixed; | |
text-decoration: none; | |
transition: background-color 400ms, border-color 400ms; | |
z-index: 10000; | |
} | |
.meta-link:hover { | |
background-color: rgba(255, 255, 255, 0.1); | |
border: 1px solid rgba(255, 255, 255, 0.2); | |
} | |
.meta-link > i, .meta-link > span { | |
height: 20px; | |
line-height: 20px; | |
} | |
.meta-link > span { | |
color: white; | |
font-family: "Rubik", sans-serif; | |
font-weight: 500; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment