-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstars.html
131 lines (115 loc) · 2.7 KB
/
stars.html
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
<!DOCTYPE html>
<!-- TheDog 2024 -->
<html>
<head>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A website for TheDog.">
<title>Stars - TheDog Codes</title>
<link rel="shortcut icon" href="images/favicon.webp" type="image/png">
</head>
<div class="background">
<div class="stars"></div>
</div>
<style>
html, body {
width: 100%;
height:100%;
cursor: none;
}
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: rgb(24, 17, 34);
background-image: linear-gradient(to top left, #1e0226, #110115, #11080d);
}
.stars {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: transparent;
opacity: 0;
transition: opacity 2s ease-in-out;
}
.star {
position: absolute;
top: 0;
left: 0;
width: 5px;
height: 5px;
border-radius: 50%;
background-color: white;
animation: pulse 3s ease-in-out infinite;
}
.fade-in {
opacity: 1;
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 0.5;
}
50% {
transform: scale(1.5);
opacity: 1;
}
100% {
transform: scale(1);
opacity: 0.5;
}
}
.star:nth-child(1) {
animation-delay: 0.1s;
}
.star:nth-child(2) {
animation-delay: 0.3s;
}
.star:nth-child(3) {
animation-delay: 0.5s;
}
.header, .footer {
background-color: #222;
color: #fffefe;
text-align: center;
padding: 10px;
opacity: 0.7;
border-radius: 20px;
font-size: 20px;
}
h1 {
font-family: "Borel", sans-serif;
}
p {
font-family: "Borel", sans-serif;
}
.content {
margin: 0 auto;
width: 600px;
}
</style>
<script>
const starsContainer = document.querySelector('.stars');
const numStars = 100;
for (let i = 0; i < numStars; i++) {
const star = document.createElement('div');
star.classList.add('star');
star.style.top = `${Math.random() * 100}%`;
star.style.left = `${Math.random() * 100}%`;
star.style.animationDelay = `${Math.random() * 2}s`;
starsContainer.appendChild(star);
}
setTimeout(() => {
starsContainer.classList.add('fade-in');
}, 1000);
document.addEventListener('mousemove', e => {
const x = e.clientX / window.innerWidth;
const y = e.clientY / window.innerHeight;
starsContainer.style.transform = `translate(-${x * 50}px, -${y * 50}px)`;
});
</script>