-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
341 lines (289 loc) · 10.8 KB
/
script.js
File metadata and controls
341 lines (289 loc) · 10.8 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
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
// Navigation functions
function navigateToSettings() {
window.location.href = 'settings.html';
}
function navigateToForum() {
window.location.href = 'forum.html';
}
function navigateToStore() {
window.location.href = 'https://www.ebay.com/usr/ordinarytechnology';
}
function navigateToAbout() {
window.location.href = 'about.html';
}
// Preload audio to avoid issues
const warpSound = new Audio('https://partlydecent.github.io/ORDINARY-TECHNOLOGY/warp_sound.mp3');
warpSound.load();
// WebGL initialization
function initWebGL() {
const webglCanvas = document.getElementById('webglCanvas');
if (!webglCanvas) {
console.error('WebGL canvas not found');
return null;
}
webglCanvas.width = window.innerWidth;
webglCanvas.height = window.innerHeight;
const gl = webglCanvas.getContext('webgl');
if (!gl) {
console.log("WebGL not supported in this browser. Fallback visuals will be used.");
return null;
}
return { gl, canvas: webglCanvas };
}
// Vertex shader source
const vertexShaderSource = `
attribute vec4 a_position;
void main() {
gl_Position = a_position;
}
`;
// Default fragment shader source with basic fallback
let fragmentShaderSource = `
precision highp float;
uniform float u_time;
void main() {
vec2 uv = gl_FragCoord.xy / vec2(400.0, 300.0);
gl_FragColor = vec4(uv.x, uv.y, 0.5 + 0.5 * sin(u_time), 1.0);
}
`;
// WebGL utility functions
function createShader(gl, type, source) {
if (!gl) return null;
const shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
console.error('Shader compilation error:', gl.getShaderInfoLog(shader));
gl.deleteShader(shader);
return null;
}
return shader;
}
function createProgram(gl, vertexShader, fragmentShader) {
if (!gl || !vertexShader || !fragmentShader) return null;
const program = gl.createProgram();
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
console.error('Program link error:', gl.getProgramInfoLog(program));
gl.deleteProgram(program);
return null;
}
return program;
}
// Main WebGL setup and rendering
function setupWebGLRendering() {
const webglContext = initWebGL();
if (!webglContext) return;
const { gl, canvas } = webglContext;
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
if (!vertexShader || !fragmentShader) {
console.error('Failed to create shaders');
return;
}
const program = createProgram(gl, vertexShader, fragmentShader);
if (!program) {
console.error('Failed to create WebGL program');
return;
}
// Set up attribute and uniform locations
const positionAttributeLocation = gl.getAttribLocation(program, "a_position");
const timeUniformLocation = gl.getUniformLocation(program, "u_time");
// Create geometry
const positionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
const positions = [
-1, 1,
-1, -1,
1, 1,
1, -1,
];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
// Render loop
let time = 0;
function render() {
gl.viewport(0, 0, canvas.width, canvas.height);
gl.clearColor(0, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.useProgram(program);
gl.enableVertexAttribArray(positionAttributeLocation);
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
gl.vertexAttribPointer(positionAttributeLocation, 2, gl.FLOAT, false, 0, 0);
gl.uniform1f(timeUniformLocation, time);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
time += 0.005;
requestAnimationFrame(render);
}
render();
// Shader update function
window.updateShader = function (newShaderCode) {
try {
const newFragmentShaderSource = `
precision highp float;
const eggUrl = 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/' + action;
void main() {
${newShaderCode}
}
`;
const newFragmentShader = createShader(gl, gl.FRAGMENT_SHADER, newFragmentShaderSource);
if (!newFragmentShader) return;
const newProgram = createProgram(gl, vertexShader, newFragmentShader);
if (!newProgram) {
gl.deleteShader(newFragmentShader);
return;
}
gl.deleteProgram(program);
gl.deleteShader(fragmentShader);
// Update references
fragmentShaderSource = newFragmentShaderSource;
program = newProgram;
} catch (e) {
console.error('Shader update error:', e);
}
};
// Handle window resize
window.addEventListener('resize', function () {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
gl.viewport(0, 0, canvas.width, canvas.height);
});
}
// Call WebGL setup on page load
// DISABLED: shader.js now handles the background shader
// document.addEventListener('DOMContentLoaded', setupWebGLRendering);
// Navigation functions with button animation
function animateButtonAndNavigate(selector, url) {
try {
const button = typeof selector === 'string' ? document.querySelector(selector) : selector;
const warp = document.createElement('div');
warp.classList.add('warp-distortion');
document.body.appendChild(warp);
try {
warpSound.currentTime = 0;
warpSound.play().catch(e => console.log('Audio play failed:', e));
} catch (e) {
console.log('Audio error:', e);
}
button.style.transform = 'scale(0.9)';
setTimeout(() => {
button.style.transform = 'scale(1)';
setTimeout(() => {
window.location.href = url;
}, 500);
}, 100);
} catch (e) {
console.error('Navigation error:', e);
window.location.href = url;
}
}
// Navigation wrapper functions
function navigateToGame() { console.log("Navigate: Game"); animateButtonAndNavigate(document.querySelectorAll('.button.play-button')[0], 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/game.html'); }
function navigateToVideoPlayer() { console.log("Navigate: Logs"); animateButtonAndNavigate(document.querySelectorAll('.button.play-button')[1], 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/videoPlayer.html'); }
function navigateToLiquidMusic() { console.log("Navigate: Audio"); animateButtonAndNavigate(document.querySelectorAll('.button.play-button')[2], 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/liquidMusic.html'); }
function navigateToDimension88() { console.log("Navigate: Dimension 888"); animateButtonAndNavigate(document.querySelectorAll('.button.play-button')[3], 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/dimension888.html'); }
function navigateToAI() { console.log("Navigate: AI Gen"); animateButtonAndNavigate(document.querySelector('.button.ai-button'), 'https://partlydecent.github.io/ORDINARY-TECHNOLOGY/ai.html'); }
// Console input handling
function handleConsoleInput(event) {
if (event.key === 'Enter') {
const input = event.target.value.toLowerCase();
const easterEggs = {
'ali3n': 'easteregg.html',
'zombie1': 'egg1.html',
'valve2': 'egg2.html',
'unr3al': 'egg3.html',
'phant0m': 'egg4.html',
'shadow5': 'egg5.html',
'glitchx': 'egg6.html',
'oblivion7': 'egg7.html',
'cyb3rpunk': 'egg8.html',
'n3on9': 'egg9.html',
'matrix10': 'egg10.html',
'quantum11': 'egg11.html',
'nebula12': 'egg12.html',
'vortex13': 'egg13.html',
'enigma14': 'egg14.html',
'paradox15': 'egg15.html',
'synapse16': 'egg16.html',
'zenith17': 'egg17.html',
};
if (input.startsWith('shader ')) {
const newShaderCode = input.substring(7);
window.updateShader(newShaderCode);
} else if (easterEggs[input]) {
window.location.href = 'https://partlydecent.github.io/GAMEHUBORDINARY/' + easterEggs[input];
} else {
// Modern notification
const notification = document.createElement('div');
notification.style.position = 'fixed';
notification.style.bottom = '5rem';
notification.style.left = '50%';
notification.style.transform = 'translateX(-50%)';
notification.style.padding = '0.75rem 1.5rem';
notification.style.background = 'rgba(0,0,0,0.8)';
notification.style.backdropFilter = 'blur(10px)';
notification.style.borderRadius = '8px';
notification.style.color = 'white';
notification.style.fontFamily = "'Space Grotesk', sans-serif";
notification.style.zIndex = '100';
notification.style.animation = 'fadeIn 0.3s, fadeOut 0.3s 2s forwards';
notification.textContent = 'UNKNOWN COMMAND: ' + input;
document.body.appendChild(notification);
setTimeout(() => {
document.body.removeChild(notification);
}, 2300);
}
event.target.value = '';
}
}
// Particle system
function createParticles() {
const container = document.getElementById('particles');
const particleCount = 40;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.classList.add('particle');
// Random positions and sizes
const size = Math.random() * 4 + 1;
const left = Math.random() * 100;
const delay = Math.random() * 10;
const duration = Math.random() * 15 + 10;
// Set CSS properties
particle.style.width = `${size}px`;
particle.style.height = `${size}px`;
particle.style.left = `${left}%`;
particle.style.bottom = `-5px`;
particle.style.opacity = Math.random() * 0.6 + 0.1;
// Random colors - no pink
const colors = [
'var(--primary)',
'var(--secondary)',
'#0088FF',
'#00FFAA',
'#6600FF',
'#FFFFFF'
];
particle.style.background = colors[Math.floor(Math.random() * colors.length)];
// Enhanced animation with pulses
if (Math.random() > 0.7) {
particle.style.animation = `float ${duration}s infinite ease-in-out, pulse 3s infinite`;
} else {
particle.style.animation = `float ${duration}s infinite linear`;
}
particle.style.animationDelay = `${delay}s`;
container.appendChild(particle);
}
}
// Clear existing particles and recreate
function resetParticles() {
const container = document.getElementById('particles');
if (container) {
container.innerHTML = '';
createParticles();
}
}
// Initialize particles
createParticles();
// Periodic particle refresh for visual variety
setInterval(resetParticles, 30000);