-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
134 lines (113 loc) · 4.35 KB
/
Copy pathmain.js
File metadata and controls
134 lines (113 loc) · 4.35 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
document.addEventListener('DOMContentLoaded', function() {
// Create floating Tux
const tux = document.createElement('div');
tux.className = 'floating-tux';
tux.innerHTML = '<img src="https://accuratelinuxgraphs.com/files/img/tux.gif" alt="Fwoating Tux uwu~" width="60">';
document.body.appendChild(tux);
// Make Tux follow cursor with delay
let mouseX = 0, mouseY = 0;
let tuxX = 0, tuxY = 0;
let activeBubble = null;
document.addEventListener('mousemove', function(e) {
mouseX = e.clientX;
mouseY = e.clientY;
});
function updateTuxPosition() {
// Add some wobble
const wobbleX = Math.sin(Date.now() / 500) * 10;
const wobbleY = Math.cos(Date.now() / 500) * 10;
// Move Tux towards mouse with lag
tuxX += (mouseX - tuxX - 30) * 0.1;
tuxY += (mouseY - tuxY - 30) * 0.1;
tux.style.left = (tuxX + wobbleX) + 'px';
tux.style.top = (tuxY + wobbleY) + 'px';
// Update speech bubble position if active
if (activeBubble && !activeBubble.isRemoved) {
activeBubble.style.left = (tuxX + 50) + 'px';
activeBubble.style.top = (tuxY - 30) + 'px';
}
requestAnimationFrame(updateTuxPosition);
}
updateTuxPosition();
// Add random uwu noises
const uwuSounds = [
"uwu~", "owo", ">w<", "nyaa~", "rawr x3", "ᵘʷᵘ", "♡(ᐡᴗ ﻌ ᴗᐡ)♡",
"I wuv Winux!", "GNU/Winux", "I use Awch btw"
];
function createNewBubble() {
// Remove old bubble if exists
if (activeBubble) {
activeBubble.style.opacity = 0;
setTimeout(() => {
if (activeBubble && activeBubble.parentNode) {
document.body.removeChild(activeBubble);
}
activeBubble.isRemoved = true;
}, 1000);
}
// Create new bubble
const bubble = document.createElement('div');
bubble.className = 'speech-bubble';
bubble.textContent = uwuSounds[Math.floor(Math.random() * uwuSounds.length)];
bubble.style.left = (tuxX + 50) + 'px';
bubble.style.top = (tuxY - 30) + 'px';
document.body.appendChild(bubble);
// Track the active bubble
activeBubble = bubble;
activeBubble.isRemoved = false;
// Schedule bubble removal
setTimeout(function() {
if (activeBubble === bubble) {
bubble.style.opacity = 0;
setTimeout(function() {
if (bubble.parentNode) {
document.body.removeChild(bubble);
}
if (activeBubble === bubble) {
activeBubble.isRemoved = true;
}
}, 1000);
}
}, 3000);
}
// Create first bubble after a delay
setTimeout(createNewBubble, 2000);
// Create new bubbles periodically
setInterval(createNewBubble, 2000);
// Make download buttons do a little dance
const downloadButtons = document.querySelectorAll('a[download]');
downloadButtons.forEach((button, index) => {
button.style.setProperty('--i', index);
button.addEventListener('mouseover', function() {
this.classList.add('wiggle');
setTimeout(() => {
this.classList.remove('wiggle');
}, 1000);
});
});
// Make text wave letter by letter
const descriptions = document.querySelectorAll('.graph-description');
descriptions.forEach(desc => {
const text = desc.textContent;
desc.textContent = '';
for (let i = 0; i < text.length; i++) {
const span = document.createElement('span');
span.textContent = text[i];
span.style.setProperty('--char-index', i);
desc.appendChild(span);
}
});
});
// Kawaii cursor effects
document.addEventListener('click', function(e) {
const x = e.clientX;
const y = e.clientY;
const sparkle = document.createElement('div');
sparkle.className = 'sparkle';
sparkle.style.left = x + 'px';
sparkle.style.top = y + 'px';
document.body.appendChild(sparkle);
setTimeout(function() {
sparkle.remove();
}, 1000);
});