Add project files.

This commit is contained in:
jheaps
2024-11-22 14:06:04 -07:00
parent 9ba80839e7
commit 8ae65986d4
31 changed files with 14909 additions and 0 deletions
@@ -0,0 +1,27 @@
let thresholds = [];
for (let i = 0; i <= 1.0; i += 0.01) {
thresholds.push(i);
}
const percentThresholdsOptions = {
root: null,
threshold: thresholds,
};
const updateOpacityCallback = (entries) => {
entries.forEach(entry => {
entry.target.style.opacity = entry.intersectionRatio;
});
};
const opacityObserver = new IntersectionObserver(updateOpacityCallback, percentThresholdsOptions);
window.addEventListener('load', createObserver);
function createObserver() {
const targetImages = document.querySelectorAll(".projectImage");
targetImages.forEach(targetImage => {
opacityObserver.observe(targetImage);
});
};
+3
View File
@@ -0,0 +1,3 @@
window.onload = function () {
typeText("#WelcomeMessage", "Hey! You found me! Since I have your attention, why don't I tell you about myself?");
}
+26
View File
@@ -0,0 +1,26 @@
function typeText(selector, content) {
const element = document.querySelector(selector);
if (!element) {
console.log("Element not found.");
return;
}
simulateTyping(element, content);
}
function simulateTyping(element, text) {
let index = 0;
let speed = 50;
let currentText = "";
const interval = setInterval(() => {
if (index < text.length) {
currentText += text.charAt(index);
index++;
element.textContent = currentText;
} else {
clearInterval(interval);
}
}, speed);
}