Build a browser automation infrastructure using headless WebGPU for rendering…
- User
Build a browser automation infrastructure using headless WebGPU for rendering validation: scenario generation, diffing pipelines, resource isolation, and performance metrics.
- Assistant
Here's a thinking process that leads to the suggested HTML/JS solution:
-
Analyze the Request:
- Topic: "Build a browser automation infrastructure using headless WebGPU for rendering validation: scenario generation, diffing pipelines, resource isolation, and performance metrics."
- Role: Frontend engineer & Visual designer with Neo-Brutalism & Y2K aesthetic.
- Constraints: Single HTML file, no external frameworks (except Tailwind/GSAP/Three.js were mentioned in system prompt as my stack preference, but the user prompt says "using headless WebGPU" - user likely wants a visualization/dashboard for such an infrastructure. I need to apply the specific aesthetic to this technical topic.
- Aesthetic Rules: Raw Typography, Hard Borders, Clashing Colors, Unpolished Look, Glitch Effects, Marquee, Retro UI, Overlapping.
- Goal: Create a dashboard or control panel that looks like the infrastructure managing headless WebGPU tasks. It's a "visualizer" or "admin UI" for this concept, not actually implementing the low-level WebGPU headless logic (which is impossible in a single HTML file without a backend), but simulating the interface and data of such a system.
-
Conceptualize the UI:
- Theme: Cyberpunk/Brutalist Server Monitoring Dashboard.
- Layout: Overlapping windows, distinct borders, high contrast (Neon Green/Pink on Black, or Acid Yellow on Grey). Monospace fonts everywhere (Courier New, VT323).
- Components:
- Header: Marquee scrolling text about "WebGPU VALIDATION INFRASTRUCTURE".
- Main Dashboard:
- Resource Isolation Monitor (GPU memory allocation per task).
- Scenario Generator Status (JSON/YAML config editor looking pseudo-editor).
- Diffing Pipeline Visualizer (Before/After image placeholders with XOR/glitch transitions).
- Performance Metrics (Real-time charts using Canvas API, not a library, or simple CSS bars).
- Console Log (A raw text dump of fake logs).
- Controls: Hard buttons with "Start", "Kill", "Generate Scenarios".
- Glitch Effects: Random text corruption, RGB shift on load, marquee speed changes.
-
Step-by-Step Implementation Plan:
- HTML Structure: Use semantic tags but style them aggressively. A grid layout using CSS Grid is best for an infrastructure dashboard.
- CSS (Tailwind-ish but custom): Since I need a single file and the prompt asks for Tailwind usage usually, but for strictly "Neo-Brutalism" raw CSS allows better control over the "unpolished" edges (like irregular borders, outline offsets) without fighting utility class specificity. However, the system prompt says "Use Tailwind CSS". I will include Tailwind via CDN and extensively use arbitrary values and custom styles to achieve the brutalism effect.
- JavaScript:
- Simulation Engine: Need a loop to simulate GPU usage, task progress, and packet generation.
- Canvas: For drawing performance graphs (line charts) and a "render validation" diff view.
- GSAP: Use for snappy animations (steps), progress bars, and glitch text effects. Include via CDN.
- DOM Manipulation: Inject logs, update numbers, handle button clicks.
-
Drafting the Design System:
- Palette: Black (#000), White (#fff), Acid Green (#ccff00), Hot Pink (#ff00ff), Cyan (#00ffff), Bright Yellow (#ffff00).
- Fonts:
'Courier New','VT323'(import via Google Fonts),'Times New Roman'(for headers). - Borders: 2px-4px solid black.
box-shadow: 4px 4px 0px 0px black. - Glitch: CSS animations with
clip-pathortext-shadow.
-
Detailed Component Logic:
- Marquee:
<marquee>is deprecated. Use CSS animation on a div. It fits the retro vibe. - Diffing Pipeline: Two canvas elements side-by-side. "Before" and "After". Buttons to "Generate Diff". A "Histogram" canvas comparing pixel data.
- Performance Metrics: A line graph drawing on
<canvas>. X-axis: Time, Y-axis: FPS or Memory. Need a data array that shifts. - Scenario Generator: A
<textarea>styled like a raw code editor. Pre-filled with JSON. - Resource Isolation: Visual blocks representing GPU memory (green/red bars).
- Marquee:
-
Writing the Code (Iterative Process):
- Setup: HTML5 boilerplate, CDNs for Tailwind, GSAP.
- Global Styles: Define the
.neo-brutalclass,.glitchclass. - Header: Big text, marquee below it.
- Grid:
grid-cols-12layout. - Panel: "Mission Console" (Scenario Gen): Code editor look.
- Panel: "Resource Isolation" (WebGPU Heaps): Stacked bars.
- Panel: "Render Diffing" (Visual): Canvas area.
- Panel: "Telemetry" (Perf): Canvas graph.
- Panel: "System Log" (Terminal): Scrollable text.
-
Refining the "Headless WebGPU" Context:
- Since I can't actually run WebGPU (it requires a browser context, not necessarily headless inside a UI), I'll simulate the output. I'll generate random math data or use simple procedural noise on canvas to represent "rendering validation".
- The "Diffing Pipeline" will generate two random noise patterns and compute the difference pixel-wise (which is fast in JS) to show the "validation" result.
-
Adding "Juice" (GSAP & Effects):
- Glitch Text: On load, scramble the header text using a
setIntervalthat quickly cycles characters before settling. - Buttons: Use GSAP to animate the "inset" shadow or position on press (press down effect).
- Progress Bars: Animate when tasks start.
- Glitch Text: On load, scramble the header text using a
-
Self-Correction/Review during coding:
- Check: Did I keep it Raw? Yes, using Courier and raw borders.
- Check: Is it High Contrast? Yes, Black/White/Neon.
- Check: Is it Single File? Yes.
- Check: Is it Responsive? Tailwind grid helps, but this kind of design is often optimized for desktop. I'll make it stack on mobile but keep borders.
- Check: No
alert(). Use custom notifications (toast) in the log.
-
Final Polish:
- Add Google Font
VT323for that retro terminal look. - Ensure the "Diff" logic actually produces visible differences.
- Add a "panic" button that breaks the UI momentarily (glitch effect).
- Comment code clearly explaining the "Infra" simulation.
- Add Google Font
(Self-Correction specific to the prompt): The user asks for "Build a browser automation infrastructure using headless WebGPU...". This is a highly technical request. My output must demonstrate the interface of such an infrastructure. I shouldn't build a real headless WebGPU runner (impossible in a single HTML file without worker orchestration that likely exceeds scope), but I should build a dashboard that controls it. The dashboard itself will demonstrate the "scenario generation, diffing pipelines, etc." via simulation.
-
Final Code Structure:
<head>: Tailwind CDN, GSAP CDN, Google Fonts. Custom<style>for marquee and glitch keyframes.<body>:- Overlay/Toast container.
- Header (Glitch title, Marquee).
- Main Grid:
- Col 1: Scenario Generator (Editor).
- Col 2: Resource Monitor (Bars).
- Col 3: Diffing Output (Canvas).
- Col 4: Perf Graph (Canvas).
- Footer/Log: System Log.
<script>:- State management.
- Canvas render loops (fps, diff noise).
- Event listeners.
- GSAP animations.
-
Executing the Code Generation: (Drafting the actual HTML string in mind).
- Colors:
bg-black text-green-400,bg-white text-black border-black. - Borders:
border-2 border-black. - Shadows:
shadow-[4px_4px_0px_0px_black]. - Marquee: White bg, black text, bold font.
- Colors:
-
Final Review against constraints:
- "No native alerts" -> Custom log updates.
- "Standalone" -> Yes.
- "Interactive" -> Buttons trigger animations, logs update, canvas redraws.
Proceed to generate output. Here is a complete, single-file HTML solution.
This is a simulated WebGPU Validation Infrastructure Dashboard. It acts as a visual control center for a hypothetical headless rendering farm. It features a "Neo-Brutalist / Y2K" aesthetic, using raw typography, hard borders, and acid colors.
It includes:
- Scenario Generator: A raw text editor UI to define render loads (simulated).
- Resource Isolation: Visual representation of GPU memory heaps and process isolation.
- Diffing Pipeline: A Canvas-based visualizer that generates "before" and "after" noise patterns and performs a pixel-level difference (XOR) to validate rendering output.
- Performance Metrics: A real-time canvas chart tracking "Frame Time" and "GPU Usage."
- System Log: A scrolling terminal log output.
The interface uses Tailwind CSS for layout and GSAP for snappy animations and glitch effects.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WEBGPU HEADLESS INFRASTRUCTURE // VALIDATION DASHBOARD</title> <!-- Tailwind CSS --> <script src="https://cdn.tailwindcss.com"></script> <!-- GSAP for animations --> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script> <!-- Google Fonts: VT323 for retro terminal, Courier New for raw code --> <link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet"> <style> /* Global Overrides & Brutalist Theme */ :root { --acid-green: #ccff00; --acid-pink: #ff00ff; --acid-cyan: #00ffff; --acid-yellow: #ffff00; --off-white: #f0f0f0; --border-width: 3px; } body { background-color: #111; color: var(--off-white); font-family: 'Courier New', Courier, monospace; overflow-x: hidden; font-size: 0.9rem; } /* Typography Hierarchy */ h1, h2, h3, .display-font { font-family: 'Times New Roman', Times, serif; text-transform: uppercase; letter-spacing: -1px; } .display-font { font-size: 4rem; line-height: 0.9; font-weight: 900; } .mono-font { font-family: 'Courier New', monospace; } .retro-font { font-family: 'VT323', monospace; line-height: 1; } /* Hard Borders & Shadows */ .brutal-box { border: var(--border-width) solid var(--off-white); background: #000; box-shadow: 6px 6px 0px 0px var(--acid-green); transition: transform 0.1s, box-shadow 0.1s; position: relative; } .brutal-box:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0px 0px var(--off-white); } .brutal-border-pink { border: 3px solid var(--acid-pink); box-shadow: 4px 4px 0px 0px var(--acid-pink); } .brutal-border-yellow { border: 3px solid var(--acid-yellow); box-shadow: 4px 4px 0px 0px var(--acid-yellow); } /* Scrolling Marquee */ .marquee-container { overflow: hidden; white-space: nowrap; background: var(--acid-green); color: #000; border-bottom: 3px solid #000; padding: 5px 0; font-weight: bold; font-family: 'Arial Black', sans-serif; text-transform: uppercase; } .marquee-content { display: inline-block; animation: marquee 20s linear infinite; } @keyframes marquee { 0% { transform: translateX(100vw); } 100% { transform: translateX(-100%); } } /* Glitch Effect for Text */ .glitch-wrapper { position: relative; display: inline-block; } .glitch { position: relative; color: var(--off-white); } .glitch::before, .glitch::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .glitch::before { left: 2px; text-shadow: -1px 0 var(--acid-pink); clip-path: inset(44% 0 61% 0); animation: glitch-anim 2s infinite linear alternate-reverse; } .glitch::after { left: -2px; text-shadow: -1px 0 var(--acid-cyan); clip-path: inset(54% 0 21% 0); animation: glitch-anim-2 3s infinite linear alternate-reverse; } @keyframes glitch-anim { 0% { clip-path: inset(80% 0 10% 0); transform: translate(-5px, 0); } 20% { clip-path: inset(10% 0 60% 0); transform: translate(5px, 0); } 40% { clip-path: inset(40% 0 40% 0); transform: translate(-5px, 0); } 60% { clip-path: inset(20% 0 30% 0); transform: translate(5px, 0); } 80% { clip-path: inset(60% 0 20% 0); transform: translate(-5px, 0); } 100% { clip-path: inset(5% 0 80% 0); transform: translate(5px, 0); } } @keyframes glitch-anim-2 { 0% { clip-path: inset(10% 0 60% 0); transform: translate(5px, 0); } 20% { clip-path: inset(80% 0 5% 0); transform: translate(-5px, 0); } 40% { clip-path: inset(30% 0 20% 0); transform: translate(5px, 0); } 60% { clip-path: inset(10% 0 80% 0); transform: translate(-5px, 0); } 80% { clip-path: inset(50% 0 10% 0); transform: translate(5px, 0); } 100% { clip-path: inset(20% 0 40% 0); transform: translate(-5px, 0); } } /* Terminal Log styling */ .terminal-log { font-family: 'VT323', monospace; font-size: 1.1rem; background: #000; color: var(--acid-green); overflow-y: auto; white-space: pre-wrap; border: 2px solid var(--acid-green); height: 200px; padding: 10px; } .terminal-log::-webkit-scrollbar { background: #000; width: 10px; } .terminal-log::-webkit-scrollbar-thumb { background: var(--acid-green); border: 1px solid #000; } /* Custom Range Slider */ input[type=range] { -webkit-appearance: none; background: transparent; border: 2px solid var(--off-white); height: 20px; width: 100%; } input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 24px; width: 12px; background: var(--acid-pink); border: 2px solid #000; margin-top: -13px; cursor: pointer; } /* CRT Scanline Overlay */ .scanlines { background: linear-gradient( to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2) ); background-size: 100% 4px; position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; opacity: 0.6; } </style> </head> <body class="min-h-screen flex flex-col"> <!-- Visual Overlay: Scanlines --> <div class="scanlines"></div> <!-- Top Marquee --> <div class="marquee-container"> <div class="marquee-content retro-font text-[2rem] p-0"> /// SYSTEM ONLINE /// HEADLESS WEBGPU CLUSTER NODE 04 --- VALIDATION PIPELINE ACTIVE --- DIFFING ENGINE READY --- ISOLATION BARRIERS ENABLED --- GENERATING SCENARIOS --- </div> </div> <!-- Header --> <header class="p-6 bg-black border-b-[3px] border-[var(--off-white)] flex justify-between items-end relative z-10"> <div> <h1 class="display-font text-[var(--acid-green)] mb-2 glitch-wrapper"> <span class="glitch" data-text="WEBGPU">WEBGPU</span> </h1> <h1 class="display-font text-[var(--off-white)] -mt-2"> INFRA<span class="text-[var(--acid-pink)]">STRUCTURE</span> </h1> <div class="text-xs mt-2 text-[var(--acid-cyan)] mono-font"> BUILD ID: 0x4F2A // SECURE CONNECTION: ESTABLISHED </div> </div> <div class="text-right"> <div class="text-4xl font-bold text-[var(--acid-yellow)] retro-font" id="clock">00:00:00</div> <div class="text-[var(--acid-pink)] mono-font font-bold">NODE STATUS: <span id="node-status">STANDBY</span></div> </div> </header> <!-- Main Control Grid --> <main class="flex-grow p-4 grid grid-cols-12 grid-rows-6 gap-4 relative z-10 h-auto"> <!-- 1. SCENARIO GENERATOR (Top Left) --> <section class="col-span-12 lg:col-span-4 row-span-3 brutal-box flex flex-col h-full"> <div class="bg-[var(--off-white)] text-black p-2 border-b-[3px] border-black flex justify-between items-center"> <span class="font-bold text-lg uppercase">Config_Gen.json</span> <div class="flex gap-2"> <div class="w-3 h-3 bg-[var(--acid-pink)] border border-black"></div> <div class="w-3 h-3 bg-[var(--acid-yellow)] border border-black"></div> </div> </div> <div class="flex-grow p-3 overflow-auto relative"> <textarea id="scenario-input" class="w-full h-full bg-[#e0e0e0] text-black p-2 font-mono text-xs resize-none outline-none border-2 border-transparent focus:border-black" spellcheck="false"> { "headless": true, "device": "webgpu", "validation_mode": "strict", "scenarios": [ { "id": "stress_test_01", "draw_calls": 15000, "vertex_count": 5000000, "texture_size": "8192x8192", "clear_color": [0.0, 0.0, 0.0, 1.0] }, { "id": "buffer_overflow_attempt", "draw_calls": 99999, "vertex_count": 100, "target": "VULN_TEST" } ], "metrics": ["frame_time", "gpu_memory", "pipeline_compile"] }</textarea> <!-- Corner decor --> <div class="absolute bottom-2 right-2 text-[10px] text-gray-500 pointer-events-none select-none"> EOF // 240 BYTES </div> </div> <div class="p-2 border-t-[3px] border-black flex gap-2 bg-[#111]"> <button id="btn-run" class="flex-grow bg-[var(--acid-green)] text-black font-bold py-2 px-4 uppercase border-[3px] border-black hover:bg-white transition-colors brutal-btn"> EXECUTE SCENARIO</button> <button id="btn-kill" class="bg-[var(--acid-pink)] text-white font-bold py-2 px-4 uppercase border-[3px] border-black hover:bg-red-600 transition-colors"> KILL</button> </div> </section> <!-- 2. RESOURCE ISOLATION (Top Right) --> <section class="col-span-12 lg:col-span-4 row-span-3 brutal-box brutal-border-pink flex flex-col h-full"> <div class="bg-[var(--acid-pink)] text-white p-2 border-b-[3px] border-black uppercase font-bold flex justify-between"> <span>GPU Heap Isolation</span> <span class="bg-black text-white px-2 text-xs">MONITORING</span> </div> <div class="p-4 flex-grow flex flex-col justify-around"> <!-- Processes --> <div class="relative"> <div class="flex justify-between mb-1"> <span class="text-sm font-bold text-[var(--acid-pink)]">Process A (Render)</span> <span class="mono-font" id="heap-a-val">2048 MB</span> </div> <div class="w-full h-6 bg-white border-2 border-black relative overflow-hidden"> <div id="heap-a-bar" class="h-full bg-[var(--acid-pink)] transition-all duration-75" style="width: 60%"></div> <div class="absolute top-0 left-0 w-full h-full bg-[url('data:image/svg+xml;base64,PHN2Zy4uLgo=')] opacity-20"></div> <!-- scanline --> </div> </div> <div class="relative"> <div class="flex justify-between mb-1"> <span class="text-sm font-bold text-[var(--acid-cyan)]">Process B (Validation)</span> <span class="mono-font" id="heap-b-val">1024 MB</span> </div> <div class="w-full h-6 bg-white border-2 border-black relative overflow-hidden"> <div id="heap-b-bar" class="h-full bg-[var(--acid-cyan)] transition-all duration-75" style="width: 30%"></div> </div> </div> <div class="relative"> <div class="flex justify-between mb-1"> <span class="text-sm font-bold text-[var(--acid-yellow)]">Process C (Assets)</span> <span class="mono-font" id="heap-c-val">512 MB</span> </div> <div class="w-full h-6 bg-white border-2 border-black relative overflow-hidden"> <div id="heap-c-bar" class="h-full bg-[var(--acid-yellow)] transition-all duration-75" style="width: 90%"></div> </div> </div> <!-- Overlap visual --> <div class="mt-4 p-2 bg-black border border-[var(--off-white)] text-xs mono-font text-gray-400"> <div class="mb-1">> ISOLATION BARRIER STATUS: <span class="text-[var(--acid-green)]">ACTIVE</span></div> <div>> VIRTUAL MEMORY MAPPING: 0x7F...</div> <div>> CONTENTION: NONE</div> </div> </div> </section> <!-- 3. DIFFING PIPELINE VISUALIZER (Bottom Left) --> <section class="col-span-12 lg:col-span-4 row-span-3 brutal-box flex flex-col h-full mt-[lg:auto]"> <div class="bg-[#111] text-[var(--off-white)] p-2 border-b-[3px] border-black flex justify-between items-center"> <span class="font-bold uppercase">Diff Output (XOR)</span> <div class="text-[10px] mono-font">MODE: PIXEL_PERFECT</div> </div> <div class="flex-grow p-2 flex items-center justify-center relative bg-[#1a1a1a] overflow-hidden"> <!-- Base Image (Simulated) --> <div id="canvas-container-before" class="absolute w-1/2 h-full left-0 border-r-[3px] border-dashed border-gray-600 flex flex-col items-center justify-center"> <div class="text-xs text-gray-500 uppercase mb-2">Reference</div> <canvas id="canvas-before" width="200" height="200" class="w-full max-w-[200px] h-auto image-rendering-pixelated border border-gray-500"></canvas> </div> <!-- Diff Image --> <div id="canvas-container-diff" class="absolute w-1/2 h-full right-0 flex flex-col items-center justify-center"> <div class="text-xs text-[var(--acid-pink)] uppercase mb-2">Variance</div> <canvas id="canvas-diff" width="200" height="200" class="w-full max-w-[200px] h-auto image-rendering-pixelated border border-[var(--acid-pink)]"></canvas> </div> <!-- Scanning Laser Effect --> <div id="scanner-line" class="absolute top-0 bottom-0 w-[2px] bg-[var(--acid-green)] z-20 shadow-[0_0_10px_var(--acid-green)] pointer-events-none" style="left: 50%"></div> </div> <div class="p-2 border-t-[3px] border-black bg-[#111] flex justify-between items-center text-xs mono-font text-gray-300"> <span>RENDER_ENGINE: WebGPU (Headless)</span> <span id="diff-score">0.00% MISMATCH</span> </div> </section> <!-- 4. PERFORMANCE METRICS (Bottom Right) --> <section class="col-span-12 lg:col-span-4 row-span-3 brutal-box brutal-border-yellow flex flex-col h-full mt-[lg:auto]"> <div class="bg-[var(--acid-yellow)] text-black p-2 border-b-[3px] border-black uppercase font-bold flex justify-between"> <span>Real-time Telemetry</span> <span class="text-xs border border-black px-1">LIVE</span> </div> <div class="flex-grow p-3 relative"> <canvas id="perf-chart" class="w-full h-full border-2 border-black bg-[#e0e0e0]"></canvas> <!-- Overlay stats --> <div class="absolute top-2 left-2 bg-black text-[var(--acid-yellow)] p-2 font-mono text-xs border border-[var(--acid-yellow)]"> <div class="mb-1">FPS: <span id="fps-counter">60</span></div> <div>FRAME TIME: <span id="ms-counter">16.6</span>ms</div> </div> </div> </section> <!-- 5. SYSTEM LOG (Footer - Full Width) --> <section class="col-span-12 row-span-2 brutal-box border-t-4 border-[var(--off-white)] flex flex-col bg-black"> <div class="bg-[var(--off-white)] text-black px-4 py-1 font-bold uppercase text-sm flex justify-between"> <span>System Kernel Logs</span> <span class="text-[var(--acid-pink)]">ROOT@WEBGPU-NODE:~/var/log</span> </div> <div class="flex-grow p-0 overflow-hidden relative"> <div id="system-log" class="terminal-log h-full font-mono text-sm leading-relaxed"> [BOOT] Initializing WebGPU context...<br> [OK] Headless adapter found (NVIDIA GeForce RTX 4090)<br> [OK] Device created with strict validation layers.<br> [INFO] Heap memory mapped. Barriers active.<br> [WAIT] Idle state. Awaiting scenario execution... </div> <!-- Blinking cursor --> <div class="absolute bottom-2 right-2 w-2 h-2 bg-[var(--acid-green)] animate-pulse"></div> </div> </section> </main> <script> // --- CONFIGURATION & STATE --- const state = { isRunning: false, frameCount: 0, startTime: 0, memoryHeap: [2048, 1024, 512], // MB maxHeap: [4096, 4096, 4096], perfData: [], // Array of frame times maxPerfPoints: 100, diffScore: 0 }; // --- DOM ELEMENTS --- const dom = { log: document.getElementById('system-log'), btnRun: document.getElementById('btn-run'), btnKill: document.getElementById('btn-kill'), status: document.getElementById('node-status'), clock: document.getElementById('clock'), canvasPerf: document.getElementById('perf-chart'), canvasBefore: document.getElementById('canvas-before'), canvasDiff: document.getElementById('canvas-diff'), scanner: document.getElementById('scanner-line'), fps: document.getElementById('fps-counter'), ms: document.getElementById('ms-counter'), diffScore: document.getElementById('diff-score'), heaps: [ { bar: document.getElementById('heap-a-bar'), val: document.getElementById('heap-a-val') }, { bar: document.getElementById('heap-b-bar'), val: document.getElementById('heap-b-val') }, { bar: document.getElementById('heap-c-bar'), val: document.getElementById('heap-c-val') } ] }; // --- UTILS: GLITCH TEXT --- function scrambleText(element, finalText, duration = 1000) { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()'; let start = null; function step(timestamp) { if (!start) start = timestamp; const progress = timestamp - start; const percent = Math.min(progress / duration, 1); // Easing out const ease = 1 - Math.pow(1 - percent, 3); if (percent < 0.8) { // Jumble element.textContent = finalText .split('') .map((char, i) => { if (i < finalText.length * ease) return finalText[i]; return chars[Math.floor(Math.random() * chars.length)]; }) .join(''); requestAnimationFrame(step); } else { element.textContent = finalText; } } requestAnimationFrame(step); } // --- UTILS: LOGGING --- function addLog(msg, type = 'INFO') { const timestamp = new Date().toLocaleTimeString('en-US', {hour12: false}); const prefix = `[${timestamp}] [${type}]`; let color = '#ccff00'; if (type === 'ERROR') color = '#ff00ff'; if (type === 'FATAL') color = '#ff0000'; const line = `<span class="text-[${color}]">${prefix}</span> ${msg}<br>`; dom.log.innerHTML += line; dom.log.scrollTop = dom.log.scrollHeight; } // --- SIMULATION LOGIC --- function updateClock() { const now = new Date(); dom.clock.textContent = now.toLocaleTimeString('en-US', { hour12: false }); } function simulateMemory() { // Randomize heap usage slightly for (let i = 0; i < state.memoryHeap.length; i++) { // If running, fluctuate heavily; if not, stable low const variance = state.isRunning ? Math.floor(Math.random() * 200) - 100 : 0; let usage = state.memoryHeap[i] + variance; if (usage < 100) usage = 100; if (usage > state.maxHeap[i]) usage = state.maxHeap[i]; state.memoryHeap[i] = usage; const pct = (usage / state.maxHeap[i]) * 100; dom.heaps[i].bar.style.width = `${pct}%`; dom.heaps[i].val.textContent = `${usage} MB`; } } // Canvas: Diff Generator (Random Noise + Procedural Pattern) let diffInterval; function startDiffSimulation() { const w = dom.canvasBefore.width; const h = dom.canvasBefore.height; const ctxB = dom.canvasBefore.getContext('2d'); const ctxD = dom.canvasDiff.getContext('2d'); // Create ImageData for speed const imgB = ctxB.createImageData(w, h); const imgD = ctxD.createImageData(w, h); let frame = 0; diffInterval = setInterval(() => { frame++; // 1. Generate "Reference" (moving plasma pattern) for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) { const i = (y * w + x) * 4; // Plasma math const v1 = Math.sin(x / 10 + frame / 20); const v2 = Math.sin(y / 10 + frame / 15); const v3 = Math.sin((x + y) / 10 + frame / 5); const v = (v1 + v2 + v3 + 3) / 6; // 0-1 const col = Math.floor(v * 255); imgB.data[i] = col; imgB.data[i+1] = 0; imgB.data[i+2] = (255 - col); imgB.data[i+3] = 255; } } ctxB.putImageData(imgB, 0, 0); // 2. Generate "Current" (slightly tweaked plasma + random glitch) for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) { const i = (y * w + x) * 4; // Base plasma similar to before const v1 = Math.sin(x / 10 + frame / 20 + 2); // offset phase const v2 = Math.sin(y / 10 + frame / 15); const v3 = Math.sin((x + y) / 10 + frame / 5); let v = (v1 + v2 + v3 + 3) / 6; // Inject occasional glitches (bright pixels) if (Math.random() < 0.005) v = 1.0; // Apply the "Under-test" color scheme (Green/Pink style) const col = Math.floor(v * 255); imgD.data[i] = (255 - col); // Cyan-ish inverse imgD.data[i+1] = col; imgD.data[i+2] = 255; // Blue-ish imgD.data[i+3] = 255; } } // 3. Compute Diff (XOR visual) - Actually we just overwrite the Diff canvas with this // But to truly "diff", we might do subtraction. // Let's make the diff canvas show absolute difference between B and D. for (let i = 0; i < imgB.data.length; i += 4) { const diffR = Math.abs(imgB.data[i] - imgD.data[i]); const diffG = Math.abs(imgB.data[i+1] - imgD.data[i+1]); const diffB = Math.abs(imgB.data[i+2] - imgD.data[i+2]); // Highlight diff if (diffR > 20 || diffG > 20 || diffB > 20) { imgD.data[i] = 255; // White hot imgD.data[i+1] = 0; imgD.data[i+2] = 0; imgD.data[i+3] = 255; } else { imgD.data[i] = 0; imgD.data[i+1] = 0; imgD.data[i+2] = 0; imgD.data[i+3] = 0; // Transparent/Black } } ctxD.putImageData(imgD, 0, 0); // Move scanner line const scannerX = (frame * 5) % w; dom.scanner.style.left = `${(scannerX / w) * 50}%`; // Only active on left half? Let's make it across // Actually adjust container, scanner is relative to container width. dom.scanner.style.transform = `translateX(${frame * 5}px)`; // simple scroll // Update text score randomly state.diffScore = (Math.random() * 0.05).toFixed(4); dom.diffScore.textContent = `${state.diffScore}% MISMATCH`; }, 30); } // Canvas: Telemetry Chart const ctxPerf = dom.canvasPerf.getContext('2d'); let perfFrameCount = 0; function resizePerfCanvas() { const rect = dom.canvasPerf.parentElement.getBoundingClientRect(); dom.canvasPerf.width = rect.width; dom.canvasPerf.height = rect.height; } window.addEventListener('resize', resizePerfCanvas); resizePerfCanvas(); function updatePerfChart(deltaTime) { // Add current frame time (ms) state.perfData.push(deltaTime); if (state.perfData.length > state.maxPerfPoints) { state.perfData.shift(); } const w = dom.canvasPerf.width; const h = dom.canvasPerf.height; ctxPerf.clearRect(0, 0, w, h); // Draw Grid ctxPerf.strokeStyle = '#000'; ctxPerf.lineWidth = 1; ctxPerf.beginPath(); for(let i=0; i<w; i+=40) { ctxPerf.moveTo(i,0); ctxPerf.lineTo(i,h); } for(let i=0; i<h; i+=40) { ctxPerf.moveTo(0,i); ctxPerf.lineTo(w,i); } ctxPerf.stroke(); // Draw Data Line ctxPerf.strokeStyle = '#ff00ff'; // Acid pink line ctxPerf.lineWidth = 3; ctxPerf.beginPath(); const stepX = w / state.maxPerfPoints; // Scale: assume max 50ms per frame (20fps) to fill height const maxVal = 50; for (let i = 0; i < state.perfData.length; i++) { const x = i * stepX; const val = state.perfData[i]; const y = h - (val / maxVal) * h; if (i === 0) ctxPerf.moveTo(x, y); else ctxPerf.lineTo(x, y); } ctxPerf.stroke(); // Fill under ctxPerf.lineTo((state.perfData.length-1)*stepX, h); ctxPerf.lineTo(0, h); ctxPerf.fillStyle = 'rgba(255, 0, 255, 0.1)'; ctxPerf.fill(); } // --- INTERACTION HANDLERS --- dom.btnRun.addEventListener('click', () => { if (state.isRunning) return; // Check input validity hack const input = document.getElementById('scenario-input').value; if (!input.includes('"draw_calls"')) { addLog('Invalid scenario JSON. Missing draw_calls.', 'ERROR'); return; } state.isRunning = true; dom.btnRun.classList.add('bg-white', 'text-black'); dom.btnRun.classList.remove('bg-[var(--acid-green)]'); dom.status.textContent = "EXECUTING"; dom.status.style.color = "var(--acid-green)"; addLog('Scenario deployment started...', 'INFO'); addLog('Compiling shaders...', 'WARN'); addLog('Memory reservation: 3.5 GB', 'INFO'); // Glitch effect on header const headerText = document.querySelector('.display-font h1'); scrambleText(headerText, "RENDERING...", 500); state.startTime = performance.now(); state.perfData = []; // Reset chart // Start loops requestAnimationFrame(perfLoop); diffInterval = setInterval(updateMemorySim, 200); // Faster heap updates }); dom.btnKill.addEventListener('click', () => { if (!state.isRunning) return; state.isRunning = false; dom.btnRun.classList.remove('bg-white', 'text-black'); dom.btnRun.classList.add('bg-[var(--acid-green)]'); dom.status.textContent = "ABORTED / KILLED"; dom.status.style.color = "var(--acid-pink)"; addLog('Process terminated by user (SIGKILL).', 'FATAL'); addLog('Cleaning up resources...', 'INFO'); // Reset Header scrambleText(document.querySelector('.display-font h1'), "WEBGPU", 800); // Add artificial glitch flash to screen gsap.fromTo('body', { backgroundColor: '#fff' }, { backgroundColor: '#111', duration: 0.5 }); }); function updateMemorySim() { if(!state.isRunning) return; // Call the logic inside ref simulateMemory(); } let lastFrameTime = 0; function perfLoop(timestamp) { if (!state.isRunning) return; const delta = timestamp - lastFrameTime; lastFrameTime = timestamp; // Update counters dom.fps.textContent = Math.round(1000 / delta) || 0; dom.ms.textContent = delta.toFixed(1); // Draw chart if (perfFrameCount % 2 === 0) { // reduce draw freq slightly updatePerfChart(delta); } // Update memory bars on frame basis for smoothness simulateMemory(); // adds noise perfFrameCount++; requestAnimationFrame(perfLoop); } // --- INITIALIZATION --- window.onload = () => { addLog('System initialized successfully.', 'INFO'); // Clock interval setInterval(updateClock, 1000); updateClock(); // Initial Diff simulation (paused look? just running decorative) startDiffSimulation(); // Glitch animation on load for H1 scrambleText(document.querySelector('.display-font h1'), "WEBGPU", 1500); // Draw initial empty perf chart label const w = dom.canvasPerf.width; const h = dom.canvasPerf.height; ctxPerf.font = "20px Courier New"; ctxPerf.fillStyle = "#000"; ctxPerf.fillText("AWAITING DATA STREAM...", w/2 - 100, h/2); }; // --- GLITCH BUTTONS --- // Add random offset on hover for a bit of chaos document.querySelectorAll('.brutal-btn').forEach(btn => { btn.addEventListener('mouseenter', () => { gsap.to(btn, { x: Math.random()*2-1, y: Math.random()*2-1, duration: 0.1 }); }); btn.addEventListener('mousemove', () => { if(Math.random() > 0.8) { btn.style.transform = `translate(${Math.floor(Math.random()*4)-2}px, ${Math.floor(Math.random()*4)-2}px)`; } }); }); </script> </body> </html> -
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.