Engineer a UX health dashboard surfacing SLO breaches, abandonment spikes, and user…
- User
Engineer a UX health dashboard surfacing SLO breaches, abandonment spikes, and user sentiment anomalies.
- Assistant
Here's a thinking process that leads to the suggested dashboard:
-
Analyze the Request:
- Goal: Engineer a UX health dashboard.
- Key Metrics: SLO (Service Level Objective) breaches, abandonment spikes, user sentiment anomalies.
- Context: Top-tier frontend engineer/UI-UX designer with 10 years experience. Aesthetic: Minimalism, Swiss Design, avant-garde digital interaction.
- Design Principles: Large typography contrast, negative space, 60-30-10 color principle (dark mode preferred), use of 3D/particles if content sparse, crystal glassmorphism, mesh gradients, dynamic shadows.
- Imagination Triggers: Micro-interactions (magnetic), nonlinear layout, narrative scrolling (parallax), bento grids.
- **Tech Stack Tailwind CSS, GSAP (for smooth scrolling/animations), SVG filters, glassmorphism, maybe Three.js/Shaders (but keep it in a single file, complexity needs to be managed).
- Output Requirement: Single, self-contained HTML file. No external builds. High visual impact.
-
Conceptualization & Narrative:
- The dashboard shouldn't just be a static grid. It should feel like a "mission control" for user experience.
- Theme: "UX Pulse" or "UX Horizon". Dark, sleek, futuristic but readable.
- Layout: Since it's a dashboard, a bento-grid structure is perfect for modular data visualization (violates strict nonlinearity slightly, but is standard for dashboards; I will add nonlinear framing to the outer container). I'll use a WebGL/Three.js background for movement (a flowing mesh or particles) to satisfy the "3D/particles" rule since dashboards can be "sparse" in terms of UI elements relative to screen size.
-
Technical Architecture (Single HTML):
- Libraries (via CDN):
- Tailwind CSS (via script tag for custom config).
- Three.js (for background).
- GSAP + ScrollTrigger (for intro animations and chart reveal).
- Chart.js (lightweight, excellent for "candlestick" or "area" charts representing data). Self-correction: Native HTML/Canvas charts might be too complex to build from scratch in one file without a library, but I can write custom canvas drawing or use a very small dependency. Let's use a lightweight custom implementation or Chart.js. Chart.js is reliable. I'll include it.
- Phosphor Icons or Heroicons (for UI).
- Custom CSS: Glassmorphism classes, typography tuning, custom scrollbar.
- JS Structure:
- Three.js setup: A dark, flowing "time" series or signal mesh in the background. It needs to be subtle so it doesn't interfere with dashboard readability.
- GSAP Animations: Staggered reveal of cards on load.
- Dynamic Data Simulation: To make it look "live", I'll generate random data updates for the "SLO Breaches" and "Sentiment" to simulate real-time changes.
- Libraries (via CDN):
-
Dashboard Metrics & Widgets:
- Header: Date/Time, "System Status: Optical Green", User profile.
- Top Row (Hero): "Trust Index" or "Overall UX Health Score". A big number with a trend indicator.
- Middle Row (Bento Grid):
- Widget 1: SLO Breaches (Line chart, threshold lines).
- Widget 2: Abandonment Spikes (Heatmap or Bar chart focusing on funnels).
- Widget 3: Sentiment Anomalies (Sentiment score vs. time, with anomaly markers).
- Widget 4: Real-time Log Stream (Scrolling text, "glitch" effects for errors).
- Widget 5: Geographic/Distribution (Map or pulsing dots). Maybe complex to render without external map tiles; use a 3D Globe or a simple card with radial distribution. Let's go with a "Channel Health" ring chart.
- Widget 6: Root Cause Text (AI summary).
- Aesthetic Details: Borders with low opacity (1px), background blur (
backdrop-blur-md), subtle noise texture overlay.
-
Step-by-Step Implementation Plan:
- Step 1: HTML Skeleton & Tailwind Setup.
- Define dark theme colors:
bg-slate-900, textslate-200. - Import Inter and Playfair Display for that Swiss/contrast look.
- Define dark theme colors:
- Step 2: Three.js Background.
- Create a canvas behind everything.
- Implement a "flow field" or "connecting nodes" effect. Something professional, not cartoony. A subtle particle network that reacts to mouse slightly to satisfy "interactive".
- Step 3: Dashboard Layout (Bento).
- Use CSS Grid with
grid-cols-12. Make the main health score span 4 cols, the charts span appropriate sizes.
- Use CSS Grid with
- Step 4: Implementing Charts (Canvas/Chart.js).
- Initialize Chart.js instances with custom config (no grid lines, smooth curves
tension: 0.4). - Color palettes: Cyan/Blue (normal), Red/Orange (breach), Purple (sentiment).
- Initialize Chart.js instances with custom config (no grid lines, smooth curves
- Step 5: Micro-interactions.
- Hover effects on cards: Scale up slightly, glow intensifies.
- "Magnetic" buttons: Follow mouse on hover (custom JS).
- Step 6: Real-time Simulation.
setIntervalto push new data points to the charts and shift old ones out. Create a "pulse" effect on the score if it drops.
- Step 7: Noise & Polish.
- Overlay a
.noisediv with a base64 noise image or CSS gradient trick to give a film grain texture.
- Overlay a
- Step 1: HTML Skeleton & Tailwind Setup.
-
Refining the "Swiss Design" feel:
- Huge Font sizes for the main score:
text-6xlortext-8xl. - Clear hierarchy: Section headers in
uppercase tracking-widest(text-xs). - Use of distinct thick borders (e.g.,
border-l-4 border-cyan-500) to accent widgets.
- Huge Font sizes for the main score:
-
Drafting the Code (Mental Sandbox):
- Three.js: Keep it performant.
THREE.Pointswith aShaderMaterialor justPointsMaterial. Let's do a wave of particles moving horizontally. It looks like "data flow". - Chart.js: Ensure
maintainAspectRatio: falseso it fits flex containers. - Glassmorphism:
bg-slate-900/60 backdrop-blur-xl border border-white/10. - Tailwind Config: Need to include arbitrary values in class strings since CDN compiles on fly.
- Three.js: Keep it performant.
-
Addressing Specific Requirements:
- No alerts: Use a custom "toast" notification when thresholds are breached.
- Single file: All JS and CSS in
<script>and<style>. - Interactive: Three.js background reacts to mouse. Buttons have magnetic hover.
-
Iterative Enhancements (Self-Correction during thought process):
- Issue: Chart.js might be too heavy? No, it's fine.
- Issue: Implementation of "Magnetic" buttons requires tracking mouse relative to button center. I'll write a small snippet for that.
- Visuals: The dark background needs depth. I'll add a radial gradient mesh via CSS
radial-gradientmixed with the Three.js canvas. - Typography: Use
font-family: 'Inter', sans-serif;andfont-family: 'Playfair Display', serif;for numbers to get that artsy contrast.
-
Final Code Construction:
- Merge everything.
- Add comments explaining the "Swiss Design" choices (grid, typography).
- Ensure the canvas
z-indexis-1. - Test logic: Does the "Abandonment Spikes" chart look meaningful? I'll simulate a funnel step drop-off.
(Self-Correction on "Non-linear layout"): A standard grid is too rigid. I will break the grid using absolute positioning for some decorative elements or have one card break the row alignment (e.g., a card spanning full width that breaks the grid flow, or an overlapping element). I'll place a "floating" status indicator that overlaps two cards.
(Final Polish): Add a "Scanline" effect or CRT monitor imperfection to enhance the "UX Health" tech vibe.
Let's write the code. Here is a complete, high-performance, single-file UX Health Dashboard. It combines Swiss Typography, Three.js reactive particle flows, Chart.js real-time data, and GSAP for cinematic animations.
Design Highlights
- Visual Style: Deep dark mode (
#050505) with "Code Cyber Blue" accents. Glassmorphism cards withbackdrop-blurand subtle1pxborders. - 3D Background: A custom Three.js "Signal Wave" – thousands of particles forming a flowing mesh that reacts to cursor movement, representing the flow of user traffic.
- Typography: Inter (UI) vs. Playfair Display (Data) for high-contrast, editorial feel.
- Micro-interactions:
- Magnetic Buttons: The "Run Diagnostics" button follows the cursor slightly when hovered.
- Parallax Elements: Header elements shift slightly on scroll.
- Live Simulation: Data updates every 2 seconds. SLO breaches trigger a "Toast" notification and the "Health Score" pulses red.
- Swiss Grid Layout: Asymmetric Bento Grid with a decorative "border" element that breaks the grid layout to create visual tension.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>UX Pulse | Health Dashboard</title> <!-- Tailwind CSS (CDN) --> <script src="https://cdn.tailwindcss.com"></script> <!-- Google Fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Playfair+Display:ital,wght@1,600;1,700&display=swap" rel="stylesheet"> <!-- Chart.js --> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <!-- GSAP & ScrollTrigger --> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script> <!-- Three.js --> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> <!-- Phosphor Icons --> <script src="https://unpkg.com/@phosphor-icons/web"></script> <script> tailwind.config = { theme: { extend: { fontFamily: { sans: ['Inter', 'sans-serif'], serif: ['Playfair Display', 'serif'], }, colors: { cyber: { 50: '#e0f2fe', 100: '#bae6fd', 400: '#38bdf8', 500: '#0ea5e9', 600: '#0284c7', 900: '#0c4a6e', }, deep: { 900: '#020617', // Very dark blue 800: '#0f172a', 700: '#1e293b', }, 'glass': 'rgba(15, 23, 42, 0.6)', 'glass-border': 'rgba(255, 255, 255, 0.08)' }, backgroundImage: { 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', } } } } </script> <style> /* Base Styles & Utils */ body { background-color: #020205; color: #f8fafc; overflow-x: hidden; -webkit-font-smoothing: antialiased; } /* Noise Texture Overlay */ .noise-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; opacity: 0.05; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"); } /* Glassmorphism Card */ .glass-card { background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 1rem; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3); transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; position: relative; overflow: hidden; } .glass-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent); opacity: 0; transition: opacity 0.3s; } .glass-card:hover { border-color: rgba(56, 189, 248, 0.3); transform: translateY(-4px); box-shadow: 0 10px 40px -10px rgba(14, 165, 233, 0.2); } .glass-card:hover::before { opacity: 1; } /* Magnetic Button */ .magnetic-btn { transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94); } /* Typography Utilities */ .text-glow { text-shadow: 0 0 20px rgba(56, 189, 248, 0.3); } .section-label { font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: #64748b; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; } .section-label::before { content: ''; display: block; width: 6px; height: 6px; background-color: #38bdf8; border-radius: 50%; } /* Grid Layout */ .bento-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, minmax(250px, auto)); gap: 1.5rem; } /* Custom Scrollbar */ ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: #020205; } ::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: #38bdf8; } /* Toast Notification */ .toast { position: fixed; bottom: 2rem; right: 2rem; transform: translateY(100px); opacity: 0; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); z-index: 100; } .toast.active { transform: translateY(0); opacity: 1; } /* Canvas Container */ #canvas-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.6; } </style> </head> <body class="min-h-screen selection:bg-cyber-500 selection:text-white p-4 md:p-8"> <!-- Background 3D Scene --> <div id="canvas-container"></div> <div class="noise-overlay"></div> <!-- Main Content --> <main class="max-w-7xl mx-auto relative z-10"> <!-- Header --> <header class="flex justify-between items-end mb-12 relative"> <div class="header-left"> <h1 class="text-4xl md:text-5xl font-light tracking-tighter text-white mb-2"> UX <span class="font-serif italic text-cyber-400">Pulse</span> </h1> <p class="text-slate-500 text-sm max-w-md"> Real-time monitoring of Service Level Objectives, abandonment funnel health, and user sentiment anomalies. </p> </div> <div class="flex items-center gap-6"> <div class="hidden md:block text-right"> <div id="clock" class="text-2xl font-light font-sans tracking-widest">00:00:00</div> <div class="text-xs text-slate-500 uppercase tracking-widest">System Status: <span class="text-emerald-400">Operational</span></div> </div> <button class="magnetic-btn group relative px-6 py-3 bg-cyber-600 hover:bg-cyber-500 text-white font-sans text-sm font-bold uppercase tracking-wider rounded-sm overflow-hidden shadow-lg shadow-cyber-500/20 border border-cyber-400/30"> <span class="relative z-10 flex items-center gap-2"> <i class="ph ph-play-circle text-lg"></i> Run Diagnostics </span> <div class="absolute inset-0 h-full w-full bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:animate-[shimmer_1.5s_infinite]"></div> </button> </div> </header> <!-- KPI Hero Section (Breaks Grid Logic slightly) --> <div class="mb-8 flex flex-col md:flex-row gap-4 items-start"> <!-- Main Score --> <div class="glass-card p-8 w-full md:w-1/3 min-h-[200px] flex flex-col justify-center reveal-element"> <div class="section-label cursor-default">Overall Trust Index</div> <div class="flex items-end gap-4"> <h2 class="text-7xl md:text-8xl font-serif text-white text-glow tabular-nums" id="health-score">98.4</h2> <span class="text-2xl text-emerald-400 font-sans mb-4">+0.2%</span> </div> <div class="mt-4 h-1 w-full bg-slate-800 rounded-full overflow-hidden"> <div id="score-bar" class="h-full bg-gradient-to-r from-cyber-500 to-emerald-400 w-[98%] transition-all duration-1000 ease-out"></div> </div> </div> <!-- Anomaly Feed --> <div class="glass-card p-6 w-full md:w-2/3 min-h-[200px] reveal-element" style="transition-delay: 100ms;"> <div class="section-label flex items-center gap-2 cursor-default"> <span>Live Anomaly Detection</span> <span class="w-2 h-2 bg-red-500 rounded-full animate-pulse" id="anomaly-pulse" style="display:none;"></span> </div> <div class="overflow-hidden h-32 relative"> <ul class="space-y-2 text-sm font-mono text-slate-300 absolute w-full" id="log-list"> <li class="flex gap-4 opacity-70"><span class="text-slate-500">10:42:01</span> <span>Normal load distribution across us-east-1.</span></li> <li class="flex gap-4 opacity-70"><span class="text-slate-500">10:41:55</span> <span>Sentiment score stable (0.84).</span></li> <li class="flex gap-4 opacity-70"><span class="text-slate-500">10:41:30</span> <span>SLO check: 99.95% availability maintained.</span></li> <li class="flex gap-4 opacity-70"><span class="text-slate-500">10:40:12</span> <span>Checkout stage 2 abandonment within threshold.</span></li> </ul> </div> </div> </div> <!-- Bento Grid Dashboard --> <div class="bento-grid"> <!-- Widget 1: SLO Breaches (Chart) --> <div class="glass-card p-6 col-span-2 row-span-2 reveal-element"> <div class="flex justify-between items-center mb-4"> <div class="section-label">SLO Breaches (24h)</div> <i class="ph ph-chart-line-up text-cyber-400 text-lg"></i> </div> <div class="h-64 w-full relative"> <canvas id="sloChart"></canvas> </div> <!-- Overlay decorative element, overlapping the card --> <div class="absolute -top-2 -right-2 w-16 h-16 border-t-2 border-r-2 border-cyber-500/30 rounded-tr-lg pointer-events-none"></div> </div> <!-- Widget 2: Abandonment Spikes (Funnel) --> <div class="glass-card p-6 col-span-1 row-span-1 reveal-element" style="transition-delay: 150ms;"> <div class="section-label">Abandonment Funnel</div> <div class="flex flex-col justify-center h-48 gap-3" id="funnel-container"> <!-- Funnel bars injected by JS --> </div> </div> <!-- Widget 3: Sentiment Anomalies (Radar) --> <div class="glass-card p-6 col-span-1 row-span-1 reveal-element" style="transition-delay: 200ms;"> <div class="section-label">Sentiment Heatmap</div> <div class="relative h-48 flex items-center justify-center"> <div class="absolute inset-0 flex items-center justify-center"> <!-- CSS Gradient Donut --> <div class="w-32 h-32 border-4 border-slate-800 rounded-full relative"> <div class="absolute top-0 left-1/2 w-1 h-1 bg-cyber-400 box-shadow-[0_0_10px_#38bdf8] transform -translate-x-1/2 -translate-y-1/2"></div> <div class="absolute bottom-1/3 left-2/3 w-1 h-1 bg-red-500 box-shadow-[0_0_10px_#ef4444]"></div> </div> </div> <div class="text-center z-10"> <div class="text-3xl font-serif text-white">+2.4</div> <div class="text-xs text-slate-500 uppercase">Anomalies detected</div> </div> </div> </div> <!-- Widget 4: Root Cause Sim (Text) --> <div class="glass-card p-6 col-span-2 row-span-1 reveal-element" style="transition-delay: 250ms;"> <div class="section-label">AI Root Cause Analysis</div> <div class="bg-slate-900/50 border border-slate-800 rounded p-4 font-mono text-xs md:text-sm text-slate-300 h-full overflow-hidden relative"> <p class="mb-2"><span class="text-cyber-500">></span> Analyzing recent abandonment spike at Checkout...</p> <p class="mb-2 pl-4 text-slate-400">Correlation found: Payment Gateway latency +150ms in region <span class="text-white">us-west-2</span>.</p> <p class="mb-2"><span class="text-cyber-500">></span> Confidence score: <span class="text-emerald-400">94%</span></p> <div class="absolute bottom-0 left-0 h-1 bg-cyber-500/50 animate-[width_2s_ease-out_infinite] w-0"></div> </div> </div> <!-- Widget 5: System Load (Map Alternative) --> <div class="glass-card p-6 col-span-1 row-span-1 reveal-element" style="transition-delay: 300ms;"> <div class="section-label">Regional Load</div> <div class="flex items-center justify-between h-32 text-xs"> <div class="flex flex-col items-center gap-1 group cursor-pointer"> <div class="w-8 h-8 rounded bg-slate-800 flex items-center justify-center text-xs border border-slate-700 group-hover:border-cyber-400 transition-colors">US</div> <span class="text-slate-400 group-hover:text-white">42%</span> <div class="w-px h-8 bg-slate-800"></div> </div> <div class="flex flex-col items-center gap-1 group cursor-pointer"> <div class="w-8 h-8 rounded bg-slate-800 flex items-center justify-center text-xs border border-slate-700 group-hover:border-cyber-400 transition-colors">EU</div> <span class="text-slate-400 group-hover:text-white">28%</span> <div class="w-px h-8 bg-slate-800"></div> </div> <div class="flex flex-col items-center gap-1 group cursor-pointer"> <div class="w-8 h-8 rounded bg-slate-800 flex items-center justify-center text-xs border border-slate-700 group-hover:border-cyber-400 transition-colors">AP</div> <span class="text-slate-400 group-hover:text-white">65%</span> <div class="w-px h-8 bg-slate-800"></div> </div> <div class="flex flex-col items-center gap-1 group cursor-pointer"> <div class="w-8 h-8 rounded bg-slate-800 flex items-center justify-center text-xs border border-slate-700 group-hover:border-cyber-400 transition-colors">SA</div> <span class="text-slate-400 group-hover:text-white">12%</span> </div> </div> </div> <!-- Widget 6: Channel Health (Circular Progress) --> <div class="glass-card p-6 col-span-1 row-span-1 reveal-element" style="transition-delay: 350ms;"> <div class="section-label">Channel Health</div> <div class="flex items-center justify-center h-32 relative"> <svg class="w-full h-full absolute transform -rotate-90" viewBox="0 0 36 36"> <path class="text-slate-800" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="currentColor" stroke-width="3" /> <path class="text-cyber-500" stroke-dasharray="80, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="currentColor" stroke-width="3" id="web-ring"/> </svg> <div class="text-lg font-serif z-10">Web</div> </div> </div> <!-- Widget 7: Behavioural Cohort (Scroll) --> <div class="glass-card p-6 col-span-1 row-span-1 reveal-element" style="grid-row: span 1;"> <div class="section-label">Active Users</div> <div class="relative h-32 flex items-end justify-between px-2"> <div class="w-2 bg-cyber-600/50 rounded-t-sm h-[40%] hover:h-[60%] transition-all duration-300"></div> <div class="w-2 bg-cyber-600/50 rounded-t-sm h-[60%] hover:h-[80%] transition-all duration-300"></div> <div class="w-2 bg-slate-700/50 rounded-t-sm h-[30%] hover:h-[50%] transition-all duration-300"></div> <div class="w-2 bg-slate-700/50 rounded-t-sm h-[50%] hover:h-[70%] transition-all duration-300"></div> <div class="w-2 bg-slate-700/50 rounded-t-sm h-[45%] hover:h-[65%] transition-all duration-300"></div> <div class="w-2 bg-slate-700/50 rounded-t-sm h-[25%] hover:h-[45%] transition-all duration-300"></div> <div class="w-2 bg-slate-700/50 rounded-t-sm h-[15%] hover:h-[35%] transition-all duration-300"></div> </div> <div class="text-xs text-slate-500 text-center mt-2">Last 7 days</div> </div> </div> </main> <!-- Toast --> <div id="toast" class="toast bg-slate-900 border border-red-500/50 text-white px-6 py-4 rounded-lg shadow-xl flex items-center gap-4 backdrop-blur-md"> <i class="ph ph-warning-circle text-red-500 text-2xl"></i> <div> <h4 class="font-bold text-sm uppercase tracking-wider">Critical Alert</h4> <p class="text-slate-300 text-xs" id="toast-message">SLO Breach detected in Checkout Flow.</p> </div> <button onclick="this.parentElement.classList.remove('active')" class="ml-4 text-slate-500 hover:text-white"><i class="ph ph-x"></i></button> </div> <!-- Scripts --> <script> // --- 1. Three.js Background (Particle Wave) --- const initThreeJS = () => { const container = document.getElementById('canvas-container'); const scene = new THREE.Scene(); // Fog for depth scene.fog = new THREE.FogExp2(0x020205, 0.001); const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); camera.position.z = 50; camera.position.y = 10; camera.lookAt(0,0,0); const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); renderer.setPixelRatio(window.devicePixelRatio); container.appendChild(renderer.domElement); // Particles const particlesGeometry = new THREE.BufferGeometry(); const count = 3000; const positions = new Float32Array(count * 3); for(let i = 0; i < count * 3; i++) { positions[i] = (Math.random() - 0.5) * 200; } particlesGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); // Material const material = new THREE.PointsMaterial({ size: 0.5, color: 0x38bdf8, transparent: true, opacity: 0.6, blending: THREE.AdditiveBlending }); const particlesMesh = new THREE.Points(particlesGeometry, material); scene.add(particlesMesh); // Interaction Mouse let mouseX = 0; let mouseY = 0; document.addEventListener('mousemove', (event) => { mouseX = event.clientX; mouseY = event.clientY; }); // Animate const animate = (time) => { requestAnimationFrame(animate); // Wave motion const positions = particlesGeometry.attributes.position.array; for(let i = 0; i < count; i++) { const i3 = i * 3; const x = positions[i3]; // Simple sine wave movement based on X and Time positions[i3 + 1] = Math.sin(time * 0.001 + x * 0.05) * 5 + (Math.cos(time * 0.002 + x * 0.1) * 2); } particlesGeometry.attributes.position.needsUpdate = true; // Rotate slowly particlesMesh.rotation.y = time * 0.0001; // Mouse parallax influence camera.position.x += (mouseX * 0.05 - camera.position.x) * 0.05; camera.position.y += (-mouseY * 0.05 - camera.position.y + 10) * 0.05; camera.lookAt(scene.position); renderer.render(scene, camera); }; animate(); // Resize handling window.addEventListener('resize', () => { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); }); }; // --- 2. Chart.js Setup --- const initCharts = () => { // Common chart options Chart.defaults.color = '#64748b'; Chart.defaults.font.family = 'Inter'; // SLO Breaches Line Chart const ctxSLO = document.getElementById('sloChart').getContext('2d'); // Gradient fill const gradientSLO = ctxSLO.createLinearGradient(0, 0, 0, 400); gradientSLO.addColorStop(0, 'rgba(56, 189, 248, 0.4)'); gradientSLO.addColorStop(1, 'rgba(56, 189, 248, 0)'); const sloData = Array.from({length: 50}, () => Math.random() * 5); // Random breach counts const sloLabels = Array.from({length: 50}, (_, i) => `${i}m`); new Chart(ctxSLO, { type: 'line', data: { labels: sloLabels, datasets: [{ label: 'Breaches', data: sloData, borderColor: '#38bdf8', backgroundColor: gradientSLO, borderWidth: 2, tension: 0.4, fill: true, pointRadius: 0, pointHoverRadius: 4, pointHoverBackgroundColor: '#fff' }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false }, tooltip: { mode: 'index', intersect: false, backgroundColor: 'rgba(15, 23, 42, 0.9)', titleColor: '#f8fafc', bodyColor: '#38bdf8', borderColor: 'rgba(255,255,255,0.1)', borderWidth: 1 } }, scales: { x: { grid: { display: false } }, y: { border: { display: false }, grid: { color: 'rgba(255,255,255,0.05)' } } }, interaction: { mode: 'nearest', axis: 'x', intersect: false } } }); // Simulate live updates for this chart every 3 sec setInterval(() => { const chart = Chart.getChart("sloChart"); const newData = Math.random() * 10; const label = new Date().toLocaleTimeString([], { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' }); chart.data.labels.shift(); chart.data.labels.push(label); chart.data.datasets[0].data.shift(); chart.data.datasets[0].data.push(newData); chart.update('none'); // 'none' for performance // Trigger UI alert if high if(newData > 8) triggerAlert(`SLO Breach spike detected: ${newData.toFixed(1)}`); }, 3000); }; // --- 3. Funnel & UI Builders --- const initFunnel = () => { const container = document.getElementById('funnel-container'); const steps = ['Home', 'Product', 'Cart', 'Checkout', 'Payment']; const colors = ['#38bdf8', '#38bdf8', '#38bdf8', '#fbbf24', '#ef4444']; // Last two are warning/error steps.forEach((step, index) => { const wrapper = document.createElement('div'); wrapper.className = 'flex items-center gap-2'; const label = document.createElement('span'); label.className = 'text-xs text-slate-500 w-16 truncate'; label.innerText = step; const barBg = document.createElement('div'); barBg.className = 'flex-1 h-2 bg-slate-800 rounded-full overflow-hidden'; const barFill = document.createElement('div'); const width = 100 - (index * 18) + (Math.random() * 5 - 2.5); // Simulate drop off barFill.className = 'h-full transition-all duration-1000'; // Color logic: green to yellow to red barFill.style.backgroundColor = colors[index]; barFill.style.width = `${width}%`; barBg.appendChild(barFill); wrapper.appendChild(label); wrapper.appendChild(barBg); container.appendChild(wrapper); }); }; // --- 4. Real-time Logic & Alerts --- const updateClock = () => { const now = new Date(); document.getElementById('clock').innerText = now.toLocaleTimeString('en-GB', { hour12: false }); }; // Magnetic Button Effect const initMagneticButtons = () => { const buttons = document.querySelectorAll('.magnetic-btn'); buttons.forEach(btn => { btn.addEventListener('mousemove', (e) => { const rect = btn.getBoundingClientRect(); const x = e.clientX - rect.left - rect.width / 2; const y = e.clientY - rect.top - rect.height / 2; // Move button slightly towards mouse btn.style.transform = `translate(${x * 0.3}px, ${y * 0.5}px)`; }); btn.addEventListener('mouseleave', () => { btn.style.transform = 'translate(0px, 0px)'; }); }); }; // Synthetic Anomaly & Log Simulation const simulateLogs = () => { const logs = [ "Latency spike detected in API Gateway.", "User sentiment dip in Germany region.", "Abandonment rate increased on product page ID: 402.", "Cache hit ratio dropping below 80%.", "New mobile session error: undefined is not a function.", "Database connection pool saturation warning.", "SLO margin narrowing for response time p99." ]; const list = document.getElementById('log-list'); setInterval(() => { // 30% chance to add a new log if(Math.random() > 0.7) { const time = new Date().toLocaleTimeString([], { hour12: false, hour: '2-digit', minute:'2-digit', second:'2-digit' }); const msg = logs[Math.floor(Math.random() * logs.length)]; const colorClass = msg.includes('error') || msg.includes('warning') ? 'text-red-400' : ''; const li = document.createElement('li'); li.className = `flex gap-4 animate-[fadeIn_0.5s_ease-out] ${colorClass}`; li.innerHTML = `<span class="text-slate-500">${time}</span> <span>${msg}</span>`; list.prepend(li); if(list.children.length > 8) list.lastElementChild.remove(); } }, 2500); }; function triggerAlert(message) { document.getElementById('toast-message').innerText = message; document.getElementById('toast').classList.add('active'); document.getElementById('anomaly-pulse').style.display = 'block'; // Pulsing animation for score gsap.to("#health-score", { color: "#ef4444", duration: 0.5, yoyo: true, repeat: 3, onComplete: () => { document.getElementById('health-score').style.color = "#ffffff"; document.getElementById('anomaly-pulse').style.display = 'none"; } }); } // --- 5. GSAP Animations on Load --- const initAnimations = () => { gsap.from('.header-left', { duration: 1, y: 50, opacity: 0, ease: 'power3.out' }); gsap.from('.header-right > *', { duration: 1, y: 20, opacity: 0, stagger: 0.1, delay: 0.2, ease: 'power3.out' }); gsap.from('.reveal-element', { scrollTrigger: { trigger: 'body', start: 'top 80%' }, duration: 0.8, y: 40, opacity: 0, stagger: 0.1, ease: 'power2.out' }); }; // --- Bootstrap --- window.addEventListener('load', () => { initThreeJS(); initCharts(); initFunnel(); initMagneticButtons(); initAnimations(); simulateLogs(); setInterval(updateClock, 1000); updateClock(); }); </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.