-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
92 lines (72 loc) · 2.82 KB
/
script.js
File metadata and controls
92 lines (72 loc) · 2.82 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
const birthDate = new Date("2006-08-22"); // Jan 1, 2000 — assumes 00:00:00
function updateLifeClock() {
const now = new Date();
const diff = now - birthDate;
const seconds = Math.floor(diff / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
const years = Math.floor(days / 365.25);
const months = Math.floor(days / 30.44) % 12;
const remainingDays = Math.floor(days % 30.44);
const remainingHours = hours % 24;
const remainingMinutes = minutes % 60;
const remainingSeconds = seconds % 60;
document.getElementById("clock").textContent =
`${years}y ${months}m ${remainingDays}d ` +
`${remainingHours}h ${remainingMinutes}m ${remainingSeconds}s`;
}
setInterval(updateLifeClock, 1000);
updateLifeClock();
const canvas = document.getElementById('confetti-canvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const colors = ['#ff0a54', '#ff477e', '#ff85a1', '#fbb1bd', '#f9bec7'];
const particles = Array.from({ length: 500 }, () => ({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height - canvas.height,
r: Math.random() * 6 + 2,
d: Math.random() * 100,
color: colors[Math.floor(Math.random() * colors.length)],
tilt: Math.random() * 10 - 10,
}));
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach((p, i) => {
ctx.beginPath();
ctx.fillStyle = p.color;
ctx.ellipse(p.x, p.y, p.r, p.r / 2, p.tilt, 0, Math.PI * 2);
ctx.fill();
p.y += 2 + Math.sin(i);
p.x += Math.sin(p.d / 10);
if (p.y > canvas.height) {
p.y = -10;
p.x = Math.random() * canvas.width;
}
});
requestAnimationFrame(draw);
}
draw();
const photos = ["add1.jpg", "add3.jpg","add4.jpg","add2.jpg"];
let current = 0;
function showPhoto(index) {
const photo = document.getElementById("photo");
photo.style.animation = "none";
void photo.offsetWidth; // force reflow to restart animation
photo.style.animation = "fadeIn 0.6s ease";
photo.src = photos[index];
}
function nextPhoto() {
current = (current + 1) % photos.length;
showPhoto(current);
}
function prevPhoto() {
current = (current - 1 + photos.length) % photos.length;
showPhoto(current);
}
// 🔁 Auto-play every 3 seconds
setInterval(() => {
nextPhoto();
}, 5000);
if (/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { alert("This site is not available on mobile devices."); window.location = "about:blank"; }