-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
203 lines (178 loc) · 5.8 KB
/
index.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Halloween Pumpkin with Moving Eyes</title>
<style>
body {
background: radial-gradient(circle, #ff8c00 30%, #ff4500 100%);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
position: relative;
overflow: hidden;
background-size: 100% 100%;
}
/* Pumpkin surface lines */
body {
background-image:
repeating-linear-gradient(to right,
transparent,
transparent 20%,
rgba(255, 140, 0, 0.303) 25%,
rgba(0, 0, 0, 0.474) 50%,
rgba(255, 140, 0, 0) 75%),
radial-gradient(circle, #ff8c00 30%, #ff4500 100%);
background-size: 100px 100%, 100% 100%;
pointer-events: none;
/* Allow clicks to pass through */
}
.scrolling-message {
position: fixed;
/* Change to fixed to remove it from the document flow */
top: 20px;
/* Distance from the top */
white-space: nowrap;
/* Prevent text from wrapping */
font-size: 75px;
text-shadow: 2px 2px rgba(0, 0, 0, 0.5), 0 1px rgba(0, 0, 0, 0.5), 1px 0 rgba(0, 0, 0, 0.5), 0 -1px rgba(0, 0, 0, 0.5);
/* Font size for the message */
color: white;
/* Text color */
font-family: 'Arial', sans-serif;
/* Font family */
left: 100%;
/* Start completely off-screen to the right */
z-index: 1000;
/* Ensure it appears above all other elements */
animation: scroll 20s linear infinite;
}
@keyframes scroll {
0% {
transform: translateX(-120vw);
/* Start at the right edge */
}
100% {
transform: translateX(0);
/* Move to the left edge */
}
}
.face-container {
position: absolute;
top: 30%;
/* Adjust this value to move both eyes and smile */
left: 50%;
transform: translateX(-50%);
}
.eye-container {
display: flex;
gap: 40px;
}
.eye {
width: 300px;
height: 150px;
background-color: rgb(0, 0, 0);
border-radius: 150px;
position: relative;
border: 2px solid black;
}
.pupil {
width: 60px;
height: 60px;
background-color: rgb(255, 0, 0);
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: transform 0.1s;
}
.smile {
position: absolute;
top: 300%;
/* Position relative to the eye container */
left: 50%;
width: 600px;
height: 600px;
background-color: rgb(0, 0, 0);
border: 10px solid white;
border-top: none;
border-radius: 100px 100px 0 0;
transform: translate(-50%, -50%) rotate(180deg);
clip-path: polygon(50% 83.52%, 58.98% 92.42%, 63.33% 80.56%, 90% 85%, 78.57% 75%, 87.92% 55%, 63.33% 70%, 50% 50%, 39% 70%, 5% 55%, 17.25% 75%, 10% 85%, 30.56% 80.56%, 38.97% 91.58%);
}
</style>
</head>
<body>
<div class="scrolling-message">Happy Halloween</div>
<div class="face-container">
<div class="eye-container">
<div class="eye">
<div class="pupil"></div>
</div>
<div class="eye">
<div class="pupil"></div>
</div>
</div>
<div class="smile"></div>
</div>
<script>
const scrollingMessage = document.querySelector('.scrolling-message');
function updateMessage() {
const urlParams = new URLSearchParams(window.location.search);
const showText = urlParams.get('showText');
const modTextContent = urlParams.get('modTextContent');
const modFontSize = urlParams.get('modFontSize');
if (showText === 'false') {
scrollingMessage.style.display = 'none';
} else if (modTextContent) {
scrollingMessage.textContent = modTextContent || 'Happy Halloween';
}
if (modFontSize) {
scrollingMessage.style['font-size'] = parseInt(modFontSize) + 'px'; // Set custom font size
}
}
function setScrollingAnimation() {
const textWidth = scrollingMessage.offsetWidth;
const scrollDistance = (textWidth / window.innerWidth) * 100; // Convert to vw
// Set the animation duration based on scroll distance
const animationDuration = (scrollDistance + 100) / 5; // Adjust this factor for speed (e.g., divide by 10 for slower)
scrollingMessage.style.animationDuration = `${animationDuration}s`;
const keyframes = `
@keyframes scroll {
0% {
transform: translateX(-${scrollDistance + 100}vw);
}
100% {
transform: translateX(0); /* Move to the left edge */
}
}
`;
// Insert keyframes into the stylesheet
const styleSheet = document.styleSheets[0];
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
}
const eyes = document.querySelectorAll('.eye');
function movePupils() {
const randomX = Math.random() * 50 - 25; // Increased range for x direction
const randomY = Math.random() * 20 - 10; // Increased range for y direction
eyes.forEach(eye => {
const pupil = eye.querySelector('.pupil');
pupil.style.transform = `translate(-50%, -50%) translate(${randomX}px, ${randomY}px)`;
});
// Set a random timeout for the next movement
const randomDelay = Math.random() * (2000 - 750) + 750; // Random delay between 750ms and 2000ms
setTimeout(movePupils, randomDelay);
}
// Call the function to set the animation when the DOM is fully loaded
document.addEventListener('DOMContentLoaded', () => {
updateMessage();
setScrollingAnimation();
movePupils();
});
</script>
</body>
</html>