Nathanwoodburn.github.io/assets/js/hacker.js

84 lines
2.0 KiB
JavaScript
Raw Normal View History

2023-02-19 15:55:24 +11:00
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ/.?!@#$%^&*()_+";
let interval = null;
let interval2 = null;
let interval3 = null;
2023-02-20 11:10:02 +11:00
window.onload = (event) => {
2023-02-20 12:56:21 +11:00
target = document.querySelector(".nathanwoodburn");
2023-02-19 15:55:24 +11:00
let iteration = 0;
2023-02-20 11:10:02 +11:00
let final = "NATHAN.WOODBURN/";
2023-02-19 15:55:24 +11:00
clearInterval(interval);
interval = setInterval(() => {
2023-02-20 11:10:02 +11:00
target.innerText = target.innerText
2023-02-19 15:55:24 +11:00
.split("")
.map((letter, index) => {
if(index < iteration) {
2023-02-20 11:10:02 +11:00
return final[index];
2023-02-19 15:55:24 +11:00
}
return letters[Math.floor(Math.random() * 41)]
})
.join("");
2023-02-20 11:10:02 +11:00
if(iteration >= final.length){
2023-02-19 15:55:24 +11:00
clearInterval(interval);
}
iteration += 1 / 3;
2023-02-19 16:09:31 +11:00
}, 30);
2023-02-20 11:10:02 +11:00
};
document.querySelector(".copyright").onmouseover = event => {
2023-02-19 15:55:24 +11:00
let iteration2 = 0;
2023-02-20 11:10:02 +11:00
let old2 = "Copyright © Nathan Woodburn 2023";
2023-02-19 15:55:24 +11:00
console.log(old2);
clearInterval(interval2);
interval2 = setInterval(() => {
event.target.innerText = event.target.innerText
.split("")
.map((letter, index2) => {
if(index2 < iteration2) {
return old2[index2];
}
return letters[Math.floor(Math.random() * 41)]
})
.join("");
if(iteration2 >= old2.length){
clearInterval(interval2);
}
iteration2 += 1/3;
}, 10);
}
2023-02-20 11:10:02 +11:00
// document.querySelector(".hacker3").onmouseover = event => {
// let iteration3 = 0;
// let old3 = event.target.innerText;
// console.log(old3);
// clearInterval(interval3);
2023-02-19 15:55:24 +11:00
2023-02-20 11:10:02 +11:00
// interval3 = setInterval(() => {
// event.target.innerText = event.target.innerText
// .split("")
// .map((letter, index3) => {
// if(index3 < iteration3) {
// return old3[index3];
// }
2023-02-19 15:55:24 +11:00
2023-02-20 11:10:02 +11:00
// return letters[Math.floor(Math.random() * 41)]
// })
// .join("");
2023-02-19 15:55:24 +11:00
2023-02-20 11:10:02 +11:00
// if(iteration3 >= old3.length){
// clearInterval(interval3);
// }
2023-02-19 15:55:24 +11:00
2023-02-20 11:10:02 +11:00
// iteration3 += 1 / 3;
// }, 10);
// }