From 9b39f7478a799237a5189363c8ff73a027f98c2f Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 20 Feb 2023 11:10:02 +1100 Subject: [PATCH] style: Updated navbar title animation --- assets/js/hacker.js | 63 ++++++++++++++++++++++++--------------------- index.html | 4 +-- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/assets/js/hacker.js b/assets/js/hacker.js index fe55165..6f5b200 100644 --- a/assets/js/hacker.js +++ b/assets/js/hacker.js @@ -4,34 +4,37 @@ let interval = null; let interval2 = null; let interval3 = null; -document.querySelector(".hacker").onmouseover = event => { + +window.onload = (event) => { + +target = document.querySelector(".navbar-brand"); let iteration = 0; - let old = event.target.innerText; - console.log(old); + let final = "NATHAN.WOODBURN/"; clearInterval(interval); interval = setInterval(() => { - event.target.innerText = event.target.innerText + target.innerText = target.innerText .split("") .map((letter, index) => { if(index < iteration) { - return old[index]; + return final[index]; } return letters[Math.floor(Math.random() * 41)] }) .join(""); - if(iteration >= old.length){ + if(iteration >= final.length){ clearInterval(interval); } iteration += 1 / 3; }, 30); -} -document.querySelector(".hacker2").onmouseover = event => { +}; + +document.querySelector(".copyright").onmouseover = event => { let iteration2 = 0; - let old2 = event.target.innerText; + let old2 = "Copyright © Nathan Woodburn 2023"; console.log(old2); clearInterval(interval2); @@ -54,28 +57,28 @@ document.querySelector(".hacker2").onmouseover = event => { iteration2 += 1/3; }, 10); } - document.querySelector(".hacker3").onmouseover = event => { - let iteration3 = 0; - let old3 = event.target.innerText; - console.log(old3); - clearInterval(interval3); + // document.querySelector(".hacker3").onmouseover = event => { + // let iteration3 = 0; + // let old3 = event.target.innerText; + // console.log(old3); + // clearInterval(interval3); - interval3 = setInterval(() => { - event.target.innerText = event.target.innerText - .split("") - .map((letter, index3) => { - if(index3 < iteration3) { - return old3[index3]; - } + // interval3 = setInterval(() => { + // event.target.innerText = event.target.innerText + // .split("") + // .map((letter, index3) => { + // if(index3 < iteration3) { + // return old3[index3]; + // } - return letters[Math.floor(Math.random() * 41)] - }) - .join(""); + // return letters[Math.floor(Math.random() * 41)] + // }) + // .join(""); - if(iteration3 >= old3.length){ - clearInterval(interval3); - } + // if(iteration3 >= old3.length){ + // clearInterval(interval3); + // } - iteration3 += 1 / 3; - }, 10); - } \ No newline at end of file + // iteration3 += 1 / 3; + // }, 10); + // } \ No newline at end of file diff --git a/index.html b/index.html index 673a6d6..993c8a8 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@ height="0" width="0" style="display: none;visibility: hidden;">