Spaces:
Sleeping
Sleeping
Update genesis/static/animation.js
Browse files- genesis/static/animation.js +49 -66
genesis/static/animation.js
CHANGED
@@ -1,70 +1,53 @@
|
|
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 |
-
radius: Math.random() * 4 + 1,
|
26 |
-
color: Math.random() > 0.5 ? '#00ff88' : '#ffaa00',
|
27 |
-
speedX: (Math.random() - 0.5) * 1.5,
|
28 |
-
speedY: (Math.random() - 0.5) * 1.5
|
29 |
});
|
30 |
}
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
// Draw particle
|
46 |
-
ctx.beginPath();
|
47 |
-
ctx.arc(p.x, p.y, p.radius, 0, Math.PI * 2);
|
48 |
-
ctx.fillStyle = p.color;
|
49 |
-
ctx.fill();
|
50 |
-
|
51 |
-
// Connect lines if particles are close
|
52 |
-
for (let j = index + 1; j < particles.length; j++) {
|
53 |
-
let dx = particles[j].x - p.x;
|
54 |
-
let dy = particles[j].y - p.y;
|
55 |
-
let distance = Math.sqrt(dx * dx + dy * dy);
|
56 |
-
if (distance < 120) {
|
57 |
-
ctx.beginPath();
|
58 |
-
ctx.moveTo(p.x, p.y);
|
59 |
-
ctx.lineTo(particles[j].x, particles[j].y);
|
60 |
-
ctx.strokeStyle = p.color === '#00ff88' ? '#00ff88aa' : '#ffaa00aa';
|
61 |
-
ctx.lineWidth = 0.5;
|
62 |
-
ctx.stroke();
|
63 |
-
}
|
64 |
-
}
|
65 |
});
|
66 |
-
|
67 |
-
requestAnimationFrame(animate);
|
68 |
}
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Smooth fade-in for panels
|
2 |
+
document.addEventListener("DOMContentLoaded", () => {
|
3 |
+
const blocks = document.querySelectorAll(".gr-block");
|
4 |
+
blocks.forEach((block, index) => {
|
5 |
+
block.style.opacity = 0;
|
6 |
+
block.style.transform = "translateY(20px)";
|
7 |
+
setTimeout(() => {
|
8 |
+
block.style.transition = "all 0.6s ease";
|
9 |
+
block.style.opacity = 1;
|
10 |
+
block.style.transform = "translateY(0)";
|
11 |
+
}, index * 100); // Staggered load
|
12 |
+
});
|
13 |
+
});
|
14 |
+
|
15 |
+
// Button glow pulse
|
16 |
+
function pulseButtons() {
|
17 |
+
const buttons = document.querySelectorAll("button, .gr-button");
|
18 |
+
buttons.forEach(btn => {
|
19 |
+
btn.addEventListener("mouseenter", () => {
|
20 |
+
btn.style.boxShadow = "0 0 20px rgba(255, 145, 0, 0.8)";
|
21 |
+
});
|
22 |
+
btn.addEventListener("mouseleave", () => {
|
23 |
+
btn.style.boxShadow = "0 0 10px rgba(0, 255, 157, 0.4)";
|
24 |
+
});
|
|
|
|
|
|
|
|
|
25 |
});
|
26 |
}
|
27 |
+
pulseButtons();
|
28 |
+
|
29 |
+
// Graph animation on load
|
30 |
+
function animateGraphs() {
|
31 |
+
const graphs = document.querySelectorAll(".graph-container");
|
32 |
+
graphs.forEach(graph => {
|
33 |
+
graph.style.opacity = 0;
|
34 |
+
graph.style.transform = "scale(0.95)";
|
35 |
+
setTimeout(() => {
|
36 |
+
graph.style.transition = "all 0.5s ease";
|
37 |
+
graph.style.opacity = 1;
|
38 |
+
graph.style.transform = "scale(1)";
|
39 |
+
}, 300);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
});
|
|
|
|
|
41 |
}
|
42 |
+
animateGraphs();
|
43 |
+
|
44 |
+
// Auto-refresh glow for updated sections
|
45 |
+
function glowOnUpdate(selector) {
|
46 |
+
const element = document.querySelector(selector);
|
47 |
+
if (element) {
|
48 |
+
element.style.boxShadow = "0 0 25px rgba(0, 255, 157, 0.8)";
|
49 |
+
setTimeout(() => {
|
50 |
+
element.style.boxShadow = "";
|
51 |
+
}, 1000);
|
52 |
+
}
|
53 |
+
}
|