-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththree.js
88 lines (62 loc) · 2.45 KB
/
three.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
document.addEventListener("DOMContentLoaded", () => {
const moveableElements = document.querySelectorAll(".moveable-element");
moveableElements.forEach(element => {
element.addEventListener("mousemove", (event) => {
const rect = element.getBoundingClientRect();
const x = event.clientX - rect.left; // x position within the element
const y = event.clientY - rect.top; // y position within the element
const moveX = (x / rect.width) * 10 - 5; // Scale down the movement
const moveY = (y / rect.height) * 10 - 5;
element.style.transform = `translate(${moveX}px, ${moveY}px)`;
});
element.addEventListener("mouseleave", () => {
element.style.transform = "translate(0, 0)"; // Reset position on mouse leave
});
});
});
var bars = document.getElementById("nav-action");
var nav = document.getElementById("nav");
//setting up the listener
bars.addEventListener("click", barClicked, false);
//setting up the clicked Effect
function barClicked() {
bars.classList.toggle('active');
nav.classList.toggle('visible');
}
let mymenu =document.querySelector(".bars");
window.onscroll = function() {
if(window.scrollY>=100){
mymenu.style.display ="block";
}else{
mymenu.style.display="none"
}}
// when i final i well stat this
window.onload = function() {
let messages = ["About"];
let messageIndex = 0;
let myDivload = document.createElement("div");
myDivload.className = "temporary-message";
document.body.appendChild(myDivload);
function showNextMessage() {
if (messageIndex < messages.length) {
myDivload.innerHTML = `<div class="message-container"><div class="circle"></div><div>${messages[messageIndex]}</div></div>`;
myDivload.classList.remove('hidden');
setTimeout(function() {
myDivload.classList.add('hidden');
messageIndex++;
setTimeout(showNextMessage, 500);
}, 500);
} else {
myDivload.remove();
}
}
showNextMessage();
const currentTimeElement = document.getElementById('current-time');
const now = new Date();
let hours = now.getHours();
const minutes = now.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM';
const minutesFormatted = minutes < 10 ? '0' + minutes : minutes;
const timeString = `${hours}:${minutesFormatted} ${ampm}`;
currentTimeElement.textContent = timeString;
};