-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
286 lines (247 loc) · 10 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: Gorb;
src: url(Pixel\ Georgia\ Bold.ttf);
}
@font-face {
font-family: SpaceMono;
src: url(SpaceMono-Regular.ttf);
}
@font-face {
font-family: Op;
src: url(DigitalDisco.ttf);
}
@font-face {
font-family: OpTn;
src: url(DigitalDisco-Thin.ttf);
}
@font-face {
font-family: Gorg;
src: url(Pixel\ Georgia.ttf);
}
.scroll-h1 {
color: #00eeff;
font-family: Op;
font-size: 60px;
font-weight: lighter;
text-align: center;
}
.h1mimic {
font-family: Op;
font-size: 60px;
margin: 0;
/* Ensure no margin */
text-align: left;
/* Prevent text centering interference */
color: #00eeff;
font-weight: lighter;
text-align: center;
}
.verticont {
display: flex;
/* Use block layout instead of flex */
align-items: center;
justify-content: center;
}
h2 {
font-family: OpTn;
font-size: 35px;
margin: 0;
text-align: center;
color: #0099ff;
}
p {
font-family: Gorg;
font-size: 20px;
}
strong {
color: #00eeff;
font-family: Gorg;
font-weight: bolder;
}
* {
box-sizing: border-box;
}
body {
height: 100vh;
max-width: 100vw;
margin: 0;
padding: 0;
}
html {
height: 100vh;
max-width: 100vw;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="diveverything">
<div class="verticont" style="background-color: rgb(0, 0, 0); height:400px; padding: 0 10vw">
<h1 id="typewriter" class="h1mimic"></h1>
</div>
<div style="display: flex; padding: 0 10vw; height: fit-content; background-color: rgb(0, 0, 0);"
class="find_my_height">
<div style="margin: 0; width: 45vw; float: left;">
<h2>
"Whatever Shall I Do?!"
</h2>
<p style="color: white;">
..exclaims the paranoid Average Joe.
</p>
<br />
<p style="color: white;">
AI, or <strong>artificial intelligence</strong>, has effectively been the defining
subject of tech in the emerging decade. Strides in computer science have created wonders and
mysteries
beyond the comprehension of our curiously itchy brains.
</p>
<br />
<p style="color: white;">
Never failing to liken AI algorithms to humans, and continually dreaming of bequeathing
consciousness to
these curios of linear algebra, AI researchers inevitably encounter the problem of <strong>how
humans can ethically
interact with AI</strong>.
</p>
<br />
<p style="color: white;">
AI researchers are not alone in that regard, however. <strong>Observe</strong> these extremely
probable, yet intriguing
questions uttered by the common man about AI.
</p>
</div>
<div style="margin: 0; width: 45vw; float: left; background-image:url(aiside.png)">
</div>
</div>
<div id="scrollable-content" style=" height: 4000px; background-image: linear-gradient(#000000, #0000ff)"></div>
<div style="margin-top: 100px">
<h1 class="h1mimic">
Eventual uprising, you say?
</h1>
<div style="display: flex; width: 90vw; margin: 50px 0px">
<p style="width: auto; float: left;">
In any case, uprising or not, everyone could learn
a thing or two about ethics in AI: this important
subject which is likely to be one of the most
influential in these next few years.
</p>
<div style="width: 60vw;" class="verticont">
<a href="one.html" style="z-index: 9;">
<img src="go.png" style="height: 80px;">
</a>
</div>
</div>
</div>
<div style="background-image: linear-gradient(#0000ff, #000000); height: 200px;">
</div>
</div>
<script>
console.log("Starting script...");
const found_its_height = document.querySelector(".find_my_height").getBoundingClientRect().height + 400;
// Standalone scroll listener for debugging
window.addEventListener("scroll", () => {
console.log("Standalone scroll event triggered!", window.scrollY);
});
// DOMContentLoaded to ensure proper initialization
document.addEventListener("DOMContentLoaded", () => {
console.log("DOM fully loaded. Adding scroll event listener...");
initializeH1s();
// Debugging scrollability of document
document.addEventListener("scroll", () => {
console.log("Scroll detected on document!", window.scrollY);
});
});
const questionMessages = [
"It is an inarguable assertion that we are in an AI age.",
"I'm an artist! Is my art fed into AI to create falsely original art? Can this art be used to create harm?",
"How do I know that AI is fair in representing people and datasets so I can get real, generalizable info?",
"IS AI GOING TO TAKE MY JOB?!",
"Aren't internet algorithms AI? How do I know they're not feeding me things that make me oblivious to their EVENTUAL UPRISING?"
];
const questionRanges = [
{ appear: 200 + found_its_height, disappear: 600 + found_its_height },
{ appear: 1000 + found_its_height, disappear: 1400 + found_its_height },
{ appear: 1800 + found_its_height, disappear: 2200 + found_its_height },
{ appear: 2600 + found_its_height, disappear: 3000 + found_its_height },
{ appear: 3400 + found_its_height, disappear: 3800 + found_its_height }
];
const speed = 50;
function typeWriter(textElement, text) {
let i = 0;
textElement.innerHTML = "";
const cursor = document.createElement("img");
cursor.setAttribute("src", "cursor.gif");
cursor.setAttribute("style", "height: 45px;");
function write() {
if (i < text.length) {
textElement.innerHTML = text.substring(0, i + 1);
textElement.appendChild(cursor);
i++;
centerHeadingInViewport(textElement); // Call after each character is written
setTimeout(write, speed);
}
}
write();
}
function initializeH1s() {
console.log("Initializing h1 elements...");
const scrollableContent = document.getElementById("scrollable-content");
questionMessages.forEach((message, index) => {
console.log(`Creating question #${index + 1}:`, message);
if (index === 0) {
const typewriterElement = document.getElementById("typewriter");
typeWriter(typewriterElement, message);
} else {
const h1 = document.createElement("h1");
h1.className = "scroll-h1";
h1.dataset.message = message;
h1.innerText = message;
h1.style.position = "absolute"; // Make the heading position absolute
scrollableContent.appendChild(h1);
}
});
// Attach scroll listener
console.log("Adding scroll event listener to window...");
window.addEventListener("scroll", handleScroll);
}
function handleScroll() {
console.log("Handling scroll event...");
const scrollPosition = window.scrollY;
const h1Elements = document.querySelectorAll(".scroll-h1");
h1Elements.forEach((h1, index) => {
const { appear, disappear } = questionRanges[index];
if (scrollPosition >= appear && scrollPosition <= disappear) {
h1.style.opacity = "1";
if (!h1.dataset.typed) {
typeWriter(h1, h1.dataset.message);
h1.dataset.typed = "true";
}
// Center the heading in the viewport when it appears
centerHeadingInViewport(h1);
} else {
h1.style.opacity = "0";
}
});
}
// Function to center the heading in the viewport
function centerHeadingInViewport(h1Element) {
const viewportHeight = window.innerHeight;
const viewportWidth = window.innerWidth;
// Get the height and width of the heading
const h1Height = h1Element.offsetHeight;
const h1Width = h1Element.offsetWidth;
// Calculate the center position
const top = (viewportHeight - h1Height) / 2 + window.scrollY; // Add scrollY for fixed positioning
const left = (viewportWidth - h1Width) / 2;
// Apply the calculated values to the heading element
h1Element.style.top = `${top}px`;
h1Element.style.left = `${left}px`;
}
</script>
</body>
</html>