TheWheke commited on
Commit
dd7cc19
·
verified ·
1 Parent(s): e4d7238

Rename index.html to sent_disp_demo.html

Browse files
Files changed (2) hide show
  1. index.html +0 -188
  2. sent_disp_demo.html +337 -0
index.html DELETED
@@ -1,188 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width,initial-scale=1" />
6
- <title>Red Halo — Editor Safe</title>
7
-
8
- <style>
9
- html, body{
10
- margin:0;
11
- padding:0;
12
- height:100%;
13
- background:#000;
14
- overflow:hidden;
15
- }
16
-
17
- canvas{
18
- width:100%;
19
- height:100%;
20
- display:block;
21
- background:#000;
22
- }
23
- </style>
24
- </head>
25
-
26
- <body>
27
- <canvas id="gl"></canvas>
28
-
29
- <script>
30
- (() => {
31
-
32
- const canvas = document.getElementById("gl");
33
- const gl = canvas.getContext("webgl", {antialias:true}) ||
34
- canvas.getContext("experimental-webgl");
35
-
36
- if(!gl){
37
- document.body.innerHTML = "WebGL not supported";
38
- return;
39
- }
40
-
41
- /* ======================
42
- Utility
43
- ====================== */
44
- function compile(type,src){
45
- const s = gl.createShader(type);
46
- gl.shaderSource(s,src);
47
- gl.compileShader(s);
48
- if(!gl.getShaderParameter(s,gl.COMPILE_STATUS))
49
- throw gl.getShaderInfoLog(s);
50
- return s;
51
- }
52
-
53
- function program(v,f){
54
- const p = gl.createProgram();
55
- gl.attachShader(p,compile(gl.VERTEX_SHADER,v));
56
- gl.attachShader(p,compile(gl.FRAGMENT_SHADER,f));
57
- gl.linkProgram(p);
58
- if(!gl.getProgramParameter(p,gl.LINK_STATUS))
59
- throw gl.getProgramInfoLog(p);
60
- return p;
61
- }
62
-
63
- function createTex(w,h){
64
- const t = gl.createTexture();
65
- gl.bindTexture(gl.TEXTURE_2D,t);
66
- gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);
67
- gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);
68
- gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);
69
- gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);
70
- gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,w,h,0,gl.RGBA,gl.UNSIGNED_BYTE,null);
71
- return t;
72
- }
73
-
74
- function createFbo(t){
75
- const f = gl.createFramebuffer();
76
- gl.bindFramebuffer(gl.FRAMEBUFFER,f);
77
- gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,t,0);
78
- gl.bindFramebuffer(gl.FRAMEBUFFER,null);
79
- return f;
80
- }
81
-
82
- /* ======================
83
- Quad
84
- ====================== */
85
- const quad = gl.createBuffer();
86
- gl.bindBuffer(gl.ARRAY_BUFFER,quad);
87
- gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([
88
- -1,-1, 1,-1, -1,1,
89
- -1,1, 1,-1, 1,1
90
- ]),gl.STATIC_DRAW);
91
-
92
- const VS = `
93
- attribute vec2 a;
94
- varying vec2 v;
95
- void main(){
96
- v = a*0.5+0.5;
97
- gl_Position = vec4(a,0,1);
98
- }
99
- `;
100
-
101
- const FS = `
102
- precision highp float;
103
- varying vec2 v;
104
- uniform vec2 r;
105
- uniform float t;
106
-
107
- float ring(vec2 p, float rad){
108
- float d = length(p);
109
- return smoothstep(0.02,0.0,abs(d-rad));
110
- }
111
-
112
- void main(){
113
- vec2 uv = v*2.0-1.0;
114
- uv.x *= r.x/r.y;
115
-
116
- float time = t*0.8;
117
- float R = 0.35 + sin(time)*0.01;
118
-
119
- float base = ring(uv,R);
120
- float glow = exp(-8.0*abs(length(uv)-R));
121
-
122
- vec3 c = vec3(1.0,0.1,0.15)*(base*1.2 + glow*0.6);
123
- gl_FragColor = vec4(c,1.0);
124
- }
125
- `;
126
-
127
- const prog = program(VS,FS);
128
-
129
- const uRes = gl.getUniformLocation(prog,"r");
130
- const uTime = gl.getUniformLocation(prog,"t");
131
-
132
- function bind(){
133
- gl.useProgram(prog);
134
- gl.bindBuffer(gl.ARRAY_BUFFER,quad);
135
- const a = gl.getAttribLocation(prog,"a");
136
- gl.enableVertexAttribArray(a);
137
- gl.vertexAttribPointer(a,2,gl.FLOAT,false,0,0);
138
- }
139
-
140
- /* ======================
141
- Resize (Editor Safe)
142
- ====================== */
143
- let W=0,H=0;
144
-
145
- function resize(){
146
- const rect = canvas.getBoundingClientRect();
147
- const dpr = Math.max(1,window.devicePixelRatio||1);
148
- const w = Math.floor(rect.width*dpr);
149
- const h = Math.floor(rect.height*dpr);
150
-
151
- if(w!==W || h!==H){
152
- W=w; H=h;
153
- canvas.width=W;
154
- canvas.height=H;
155
- gl.viewport(0,0,W,H);
156
- }
157
- }
158
-
159
- setInterval(resize,100);
160
-
161
- /* ======================
162
- Render
163
- ====================== */
164
- const start = performance.now();
165
-
166
- function draw(){
167
- resize();
168
-
169
- const time = (performance.now()-start)/1000;
170
-
171
- gl.clearColor(0,0,0,1);
172
- gl.clear(gl.COLOR_BUFFER_BIT);
173
-
174
- bind();
175
- gl.uniform2f(uRes,W,H);
176
- gl.uniform1f(uTime,time);
177
-
178
- gl.drawArrays(gl.TRIANGLES,0,6);
179
-
180
- requestAnimationFrame(draw);
181
- }
182
-
183
- draw();
184
-
185
- })();
186
- </script>
187
- </body>
188
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sent_disp_demo.html ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>Sentinel Demo — Single Timeline Color Cycle</title>
7
+
8
+ <style>
9
+ html,body{
10
+ margin:0;
11
+ height:100%;
12
+ background:#000;
13
+ overflow:hidden;
14
+ }
15
+ canvas{
16
+ width:100%;
17
+ height:100%;
18
+ display:block;
19
+ }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <canvas id="gl"></canvas>
25
+
26
+ <script>
27
+ (() => {
28
+
29
+ const canvas=document.getElementById("gl");
30
+ const gl=canvas.getContext("webgl",{antialias:true});
31
+
32
+ if(!gl){
33
+ document.body.innerHTML="WebGL not supported";
34
+ return;
35
+ }
36
+
37
+ function resize(){
38
+ canvas.width=window.innerWidth;
39
+ canvas.height=window.innerHeight;
40
+ gl.viewport(0,0,canvas.width,canvas.height);
41
+ }
42
+ resize();
43
+ window.addEventListener("resize",resize);
44
+
45
+ function compile(type,src){
46
+ const s=gl.createShader(type);
47
+ gl.shaderSource(s,src);
48
+ gl.compileShader(s);
49
+ if(!gl.getShaderParameter(s, gl.COMPILE_STATUS)){
50
+ throw new Error(gl.getShaderInfoLog(s) || "shader compile failed");
51
+ }
52
+ return s;
53
+ }
54
+
55
+ function program(v,f){
56
+ const p=gl.createProgram();
57
+ gl.attachShader(p,compile(gl.VERTEX_SHADER,v));
58
+ gl.attachShader(p,compile(gl.FRAGMENT_SHADER,f));
59
+ gl.linkProgram(p);
60
+ if(!gl.getProgramParameter(p, gl.LINK_STATUS)){
61
+ throw new Error(gl.getProgramInfoLog(p) || "program link failed");
62
+ }
63
+ return p;
64
+ }
65
+
66
+ const quad=gl.createBuffer();
67
+ gl.bindBuffer(gl.ARRAY_BUFFER,quad);
68
+ gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([
69
+ -1,-1, 1,-1, -1, 1,
70
+ -1, 1, 1,-1, 1, 1
71
+ ]),gl.STATIC_DRAW);
72
+
73
+ const VS=`
74
+ attribute vec2 a;
75
+ varying vec2 v;
76
+ void main(){
77
+ v=a*0.5+0.5;
78
+ gl_Position=vec4(a,0.0,1.0);
79
+ }
80
+ `;
81
+
82
+ /* ================================
83
+ APPROVED HALO SHADER (ADD-ONLY)
84
+ - Added uniform vec3 uCol
85
+ - Replaced hard-coded red with uCol
86
+ ================================= */
87
+ const FS=`
88
+ precision highp float;
89
+
90
+ varying vec2 v;
91
+ uniform vec2 r;
92
+ uniform float t;
93
+
94
+ /* ADD ONLY */
95
+ uniform vec3 uCol;
96
+
97
+ float ring(vec2 p,float rad){
98
+ float d=length(p);
99
+ return smoothstep(0.02,0.0,abs(d-rad));
100
+ }
101
+
102
+ void main(){
103
+
104
+ vec2 uv=v*2.0-1.0;
105
+ uv.x*=r.x/r.y;
106
+
107
+ float time=t*0.8;
108
+
109
+ float R=0.35+sin(time)*0.01;
110
+
111
+ float phase=mod(floor(t/5.0),5.0);
112
+
113
+ if(phase==1.0){
114
+ R+=sin(atan(uv.y,uv.x)*6.0+time)*0.005;
115
+ }
116
+
117
+ if(phase==2.0){
118
+ R+=sin(length(uv)*40.0-time*2.0)*0.002;
119
+ }
120
+
121
+ if(phase==3.0){
122
+ R+=sin(time*6.0)*0.015;
123
+ }
124
+
125
+ if(phase==4.0){
126
+ R+=sin(atan(uv.y,uv.x)*80.0+time*4.0)*0.008;
127
+ }
128
+
129
+ float base=ring(uv,R);
130
+ float glow=exp(-8.0*abs(length(uv)-R));
131
+
132
+ /* CHANGED: from vec3 red to uCol */
133
+ vec3 color =
134
+ uCol*(base*1.4) +
135
+ uCol*(glow*0.8);
136
+
137
+ gl_FragColor=vec4(color,1.0);
138
+
139
+ }
140
+ `;
141
+
142
+ const prog=program(VS,FS);
143
+ const uRes=gl.getUniformLocation(prog,"r");
144
+ const uTime=gl.getUniformLocation(prog,"t");
145
+ /* ADD ONLY */
146
+ const uCol = gl.getUniformLocation(prog,"uCol");
147
+
148
+ /* ========= ADD ONLY: overlay line program (color capable) ========= */
149
+
150
+ const LINE_VS=`
151
+ attribute vec2 a;
152
+ void main(){
153
+ gl_Position=vec4(a,0.0,1.0);
154
+ }
155
+ `;
156
+
157
+ const LINE_FS=`
158
+ precision highp float;
159
+ uniform vec3 uColor;
160
+ uniform float alpha;
161
+ void main(){
162
+ gl_FragColor=vec4(uColor,alpha);
163
+ }
164
+ `;
165
+
166
+ const lineProg=program(LINE_VS,LINE_FS);
167
+ const lineA=gl.getAttribLocation(lineProg,"a");
168
+ const lineColor=gl.getUniformLocation(lineProg,"uColor");
169
+ const lineAlpha=gl.getUniformLocation(lineProg,"alpha");
170
+ const lineBuf=gl.createBuffer();
171
+
172
+ /* ========= timeline color cycle (single color active per full demo) ========= */
173
+
174
+ const TIMELINE_COLORS = [
175
+ { name:"red", rgb:[1.00,0.00,0.00] },
176
+ { name:"blue", rgb:[0.10,0.55,1.00] },
177
+ { name:"green",rgb:[0.00,1.00,0.35] },
178
+ { name:"gold", rgb:[1.00,0.78,0.12] }
179
+ ];
180
+
181
+ const PHASE_SECONDS = 5;
182
+ const PHASE_COUNT = 5;
183
+ const DEMO_CYCLE_SECONDS = PHASE_SECONDS * PHASE_COUNT; // 25s
184
+
185
+ function activeTimelineColor(time){
186
+ const completedCycles = Math.floor(time / DEMO_CYCLE_SECONDS);
187
+ const idx = completedCycles % TIMELINE_COLORS.length;
188
+ return TIMELINE_COLORS[idx].rgb;
189
+ }
190
+
191
+ /* ========= helpers ========= */
192
+
193
+ function pxToClip(x,y){
194
+ return [
195
+ (x/canvas.width)*2-1,
196
+ 1-(y/canvas.height)*2
197
+ ];
198
+ }
199
+
200
+ function useLine(color, alpha){
201
+ gl.useProgram(lineProg);
202
+ gl.bindBuffer(gl.ARRAY_BUFFER, lineBuf);
203
+ gl.enableVertexAttribArray(lineA);
204
+ gl.vertexAttribPointer(lineA,2,gl.FLOAT,false,0,0);
205
+ gl.uniform3f(lineColor, color[0], color[1], color[2]);
206
+ gl.uniform1f(lineAlpha, alpha);
207
+ }
208
+
209
+ function drawLine(x1,y1,x2,y2,color,alpha){
210
+ const p1=pxToClip(x1,y1);
211
+ const p2=pxToClip(x2,y2);
212
+ useLine(color, alpha);
213
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([p1[0],p1[1], p2[0],p2[1]]), gl.STATIC_DRAW);
214
+ gl.drawArrays(gl.LINES, 0, 2);
215
+ }
216
+
217
+ /* ========= scan arm (single color; phase 4 only) ========= */
218
+
219
+ function drawScanArm(time, color){
220
+
221
+ const phase = Math.floor(time/PHASE_SECONDS) % PHASE_COUNT;
222
+ if(phase !== 4) return;
223
+
224
+ const angle=time*0.7;
225
+ const cx=canvas.width/2;
226
+ const cy=canvas.height/2;
227
+ const len=Math.max(canvas.width,canvas.height)*1.6;
228
+
229
+ gl.enable(gl.BLEND);
230
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
231
+
232
+ const tailSteps=18;
233
+ for(let i=0;i<tailSteps;i++){
234
+ const k=i/(tailSteps-1);
235
+ const a=1.0-k;
236
+ const tailAngle=angle - k*0.35;
237
+
238
+ const tx=cx+Math.cos(tailAngle)*len;
239
+ const ty=cy+Math.sin(tailAngle)*len;
240
+
241
+ drawLine(cx,cy,tx,ty,color, 0.02 + a*0.08);
242
+ }
243
+
244
+ const x=cx+Math.cos(angle)*len;
245
+ const y=cy+Math.sin(angle)*len;
246
+
247
+ drawLine(cx,cy,x,y,color,0.36);
248
+
249
+ gl.disable(gl.BLEND);
250
+ }
251
+
252
+ /* ========= bottom timeline (single color) ========= */
253
+
254
+ function drawTimeline(time, color){
255
+ const padX = Math.max(24, canvas.width*0.08);
256
+ const xL = padX;
257
+ const xR = canvas.width - padX;
258
+ const w = xR - xL;
259
+
260
+ const y = canvas.height - Math.max(110, canvas.height*0.16);
261
+
262
+ gl.enable(gl.BLEND);
263
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
264
+
265
+ // base line
266
+ drawLine(xL,y,xR,y,color,0.10);
267
+
268
+ // ticks
269
+ const ticks=18;
270
+ for(let i=0;i<=ticks;i++){
271
+ const x=xL+(i/ticks)*w;
272
+ const h=(i%3===0)?8:4;
273
+ drawLine(x,y-h,x,y+h,color,0.08);
274
+ }
275
+
276
+ // pulse progresses over the FULL demo cycle (0..1)
277
+ const cycleT = (time % DEMO_CYCLE_SECONDS) / DEMO_CYCLE_SECONDS;
278
+ const eased = 0.5 - 0.5*Math.cos(cycleT * Math.PI * 2.0);
279
+ const px = xL + eased*w;
280
+
281
+ drawLine(px-14,y,px+14,y,color,0.55);
282
+ drawLine(px,y-10,px,y+10,color,0.35);
283
+
284
+ // trail
285
+ for(let i=1;i<=10;i++){
286
+ const tx = px - i*10;
287
+ if(tx < xL) break;
288
+ drawLine(tx-4,y,tx+4,y,color,0.14*(1-i/11));
289
+ }
290
+
291
+ gl.disable(gl.BLEND);
292
+ }
293
+
294
+ /* ========= bind halo ========= */
295
+ let aLoc=-1;
296
+ function bindHalo(){
297
+ gl.useProgram(prog);
298
+ gl.bindBuffer(gl.ARRAY_BUFFER,quad);
299
+ aLoc = gl.getAttribLocation(prog,"a");
300
+ gl.enableVertexAttribArray(aLoc);
301
+ gl.vertexAttribPointer(aLoc,2,gl.FLOAT,false,0,0);
302
+ }
303
+
304
+ const start=performance.now();
305
+
306
+ function draw(){
307
+ const time=(performance.now()-start)/1000;
308
+
309
+ // active single color for entire display (halo + overlays)
310
+ const color = activeTimelineColor(time);
311
+
312
+ gl.clearColor(0,0,0,1);
313
+ gl.clear(gl.COLOR_BUFFER_BIT);
314
+
315
+ bindHalo();
316
+
317
+ gl.uniform2f(uRes, canvas.width, canvas.height);
318
+ gl.uniform1f(uTime, time);
319
+
320
+ // halo color (ADD ONLY)
321
+ gl.uniform3f(uCol, color[0], color[1], color[2]);
322
+
323
+ gl.drawArrays(gl.TRIANGLES,0,6);
324
+
325
+ // overlays (same single color)
326
+ drawScanArm(time, color);
327
+ drawTimeline(time, color);
328
+
329
+ requestAnimationFrame(draw);
330
+ }
331
+
332
+ draw();
333
+
334
+ })();
335
+ </script>
336
+ </body>
337
+ </html>