Here's a thinking process that leads to the suggested HTML file:
-
Analyze the Request:
- Goal: Design a "Pattern Adoption Leaderboard" to celebrate teams shipping new design system primitives with usage analytics.
- Core Theme: "Neo-Brutalism" / "Y2K" aesthetic (acid colors, hard borders, raw typography, glitch effects, overlapping, marquees, etc.). No "clean" or "modern" looks.
- Technical Constraints: Single HTML file, no build steps, inline CSS/JS, Tailwind CSS, GSAP, media queries for responsiveness, usage of p5.js or Three.js or WebGL suggested (but vanilla Canvas/GSAP is usually fine for 2D), functional interactions.
- Language: The user's prompt is in English, but my instructions say "Strictly follow the language used by the user." The user used English. So I will respond in English. However, the system prompt earlier mentioned aligning with the user's language, and the user's input here is English. So I will output in English.
-
Conceptualization & Design Strategy:
- Background: Stark black (
bg-black) with maybe a grid pattern or noise.
- Typography: Huge, bold fonts. Mixing Courier New (monospace) with Times New Roman or Helvetica (bold/black). Effects: CRT scanlines, glitch text.
- Color Palette: Acid green (
#CCFF00), Hot pink (#FF00FF), Cyan (#00FFFF), Yellow (#FFFF00), White, Black. High contrast.
- Layout:
- Header: Giant, overlapping title. A marquee scrolling text updating "live".
- Main Board: A table-like structure but brutalist—thick borders, hard shadow offsets (no blur), alternating high-contrast row colors.
- Visualizations: Instead of just numbers, use pixelated bars or ASCII art charts. Maybe a canvas background with particles.
- Interactions: Hover effects should be jarring (invert colors, shift position).
- "Ship it" button: Glitchy, moving when hovered.
- Data: Fake data for teams (e.g., "Team Glitch", "Neo Stack", "Acid Wave"). Metrics: Patterns Adopted (unique components), Usage Count (instances), Velocity (per week), Badge/Score.
-
Technical Implementation Plan:
- HTML Structure: Semantic tags (
main, header, section).
- Tailwind CSS: Load via CDN. Use arbitrary values for exact pixel control (e.g.,
border-4, border-black, shadow-[4px_4px_0px_0px_rgba(0,0,0,1)]).
- GSAP: Load via CDN. Use
SteppedEase for animations, quick zooms, and marquee looping.
- Canvas: Background effect (maybe "Matrix" style but with geometric shapes or noise).
- JavaScript Logic:
- Mock data generation.
- Sorting logic (by score/usage).
- Render table rows dynamically.
- "Live" update simulation (randomly increment numbers).
- Glitch effect rendering (CSS classes toggling or canvas manipulation). simpler to use CSS keyframes for glitch.
-
Step-by-Step Construction:
- Setup: HTML skeleton, import Tailwind, import GSAP, import a pixel font (Press Start 2P or using system Courier).
- Styling (Tailwind Config inside
<style>): Define custom fonts and animation keyframes (scanlines, glitch).
- Background: A fixed canvas behind everything with a moving grid or noise.
- Header:
- Big text "PATTERN ADOPTION LEADERBOARD".
- Subtitle "SYSTEM PRIMITIVES DEPLOYMENT MONITOR".
- Marquee: ">> LIVE DATA STREAM ACTIVE <<".
- Leaderboard Table:
- Columns: Rank, Team Name, Avatar (crate or icon), Patterns Adopted, Usage Count, Velocity, Score.
- Columns needs specific styling: sticky? No, just standard.
- Styling:
bg-white or bg-green-100? Let's use alternating row colors: White, Lime Yellow, Hot Pink (too much?). Let's stick to bg-white rows with border-black-2 and bg-black text. Or maybe rows: White -> Yellow -> Cyan -> White. Neo-brutalism often uses solid distinct blocks.
- Let's go with: Row 1: White (
bg-white). Row 2: Acid Green (bg-[#CCFF00]). Row 3: Cyan (bg-[#00FFFF]). Row 4: Hot Pink (bg-[#FFCCFF]). High saturation.
- Ranking: 1st, 2nd, 3rd get special crowns or flame icons (SVG).
- Interactions:
- Hover row:
transform: translate(-2px, -2px); shadow becomes bigger.
- Click button: "SHIP IT" triggers confetti (simple canvas or DOM elements) or a "glitch" flash.
- Analytics Panel: A section below showing "Total Shipments" with a large counter that increments automatically.
- Canvas Background: A simple 2D particle system or a retro grid moving towards the camera (synthwave style). Let's do a "digital rain" or "falling geometric shapes" in high contrast (black/white or white/black).
-
Refining the "Neo-Brutalism/Y2K" Vibe:
- Hard Borders:
border-4 border-black.
- Raw Typography:
font-mono for numbers, font-sans (or Times) headings. Use uppercase.
- Glitch: CSS
@keyframes glitch with clip-path or text-shadow shifts.
- Marquee: Standard CSS animation
translateX from 0 to -100%.
-
Coding - Specifics (Mental Draft):
- Font: Google Fonts "Press Start 2P" is great for pixel, but "Courier New" fits raw. Let's use
font-family: 'Courier New', monospace for data and font-family: 'Impact', sans-serif or Arial Black for headers to mimic Windows 95 boldness.
- Tailwind: Use
border-4, tracking-tighter, uppercase.
- Data Structure: Array of objects
{ team: "NULLPTR", count: 1234, patterns: 5 }.
-
Adding Complexity/Polish:
- GSAP Animations:
- Entry: Table rows stagger in with
y: 100% -> 0%.
- Live tickers: Tween a number object to update DOM.
- "Glitch" effect on title on hover using GSAP
to with text-shadow.
- Canvas:
- Draw a grid that moves slowly.
- Draw random "data packets" (squares) falling.
- Realtime Simulation:
setInterval to slightly bump usage numbers randomly for top teams to make it feel "live".
-
Drafting the Code (Iterative refinement):
-
Self-Correction/Review against constraints:
- Single file? Yes.
- Neo-Brutalism? Yes, using hard borders, high contrast.
- No native alerts? Yes.
- Responsive? Tailwind table handling (
overflow-x-auto).
- Language? User asked in English, my output is English. (Wait, the user said "Design a pattern adoption leaderboard...", that's English. I will stick to English).
- Three.js? I could use it, but a 2D Canvas is lighter and sufficient for this "raw" feel. However, the prompt mentions "Three.js/WebGL" as a technical stack suggestion but doesn't mandate it if other options fit better. Since this is a 2D leaderboard, 2D Canvas is more appropriate and easier to keep in a single file without external heavy textures. I will use 2D Canvas for the background to keep it performant and "glitchy".
-
Final Polish:
- Ensure the "Ship It" button has a distinct Y2K look (beveled borders maybe). Actually, Neo-brutalism is flat but thick borders. Windows 95 style fits here.
border-t-2 border-l-2 border-b-4 border-r-4. Active state: border-t-4 border-r-2 border-b-2 border-l-2 (pressed effect). That's a classic UI trick.
- Add a modal/popup when "Claim" is clicked? No, keep it simple: just a notification banner or "Toast" at bottom.
-
Code Structure Assembly:
<!DOCTYPE html>
<head>: Tailwind CDN, GSAP CDN, Font Awesome (for icons). Custom CSS for glitch animations and marquee.
<body>:
- Canvas background.
- Warning/Status bar (yellow/black stripes).
- Header with huge title.
- Leaderboard Table.
- Footer with stats.
- Script tag with data, logic, animations.
-
Writing the details (Mental Check of CSS classes):
bg-white text-black border-4 border-black shadow-[4px_4px_0px_0px_#000].
- Hover:
-translate-x-1 -translate-y-1 shadow-[6px_6px_0px_0px_#000].
- Active:
translate-x-1 translate-y-1 shadow-none.
This creates the "push button" feel.
-
Generating the Response: Write the code, inject meaningful comments, ensure no placeholder images (use placeholders from picsum if absolutely needed, but render initials or patterns instead). Use SVG icons from a CDN to avoid broken images.
(Self-Correction during coding): The prompt asks for "Pattern Adoption Leaderboard to celebrate teams shipping new design system primitives".
I'll define "Primitives": Button, Input, Modal, Grid, etc.
Teams: "UI Wizards", "Pixel Pushers", "The Box Model", etc.
Metric: "Usage Count" (how many times the primitive is used in the codebase).
Secondary: "Velocity" (change in usage last week).
Badge: "First Mover", "Heavy Hitter".
Let's include a "Glitch" effect on the title using GSAP to shake random letters.
Let's build it.
(Final Code Structure Plan)
- HTML/Head setup
- Styles: Tailwind, custom scanline, glitch keyframes, hard borders.
- Body:
- Canvas (fixed).
- Container (relative, z-index higher).
- Banner (striped).
- Header (H1 Marquee).
- Stats Panel (3 key metrics).
- Leaderboard Table (responsive wrapper).
- Toast container (for notifications).
- Script:
- Teams Data.
- Render Table.
- Canvas Background Animation (Bouncing geometric shapes).
- GSAP Animations (Entrance, Title Glitch, Marquee).
- Simulation Loop (randomly update usage for "Live" feel).
- "Ship It" button logic.
Let's write the actual code now.
Here is the complete, single-file HTML solution. It embodies the Neo-Brutalism/Y2K aesthetic with hard borders, high saturation colors, raw typography, glitch effects, and a simulated live data stream.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PATTERN ADOPTION LEADERBOARD // SYSTEM PRIMITIVES</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- GSAP -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<!-- Font: System fonts mixed with Courier New for raw look -->
<style>
/* Custom Tailwind Config for Specific Colors/Fonts if needed */
:root {
--acid-green: #CCFF00;
--hot-pink: #FF00FF;
--cyan: #00FFFF;
--yellow: #FFFF00;
--off-white: #F0F0F0;
}
body {
font-family: 'Courier New', Courier, monospace;
background-color: #000;
color: #000;
overflow-x: hidden;
}
/* Hard Border Utilities */
.border-brutal {
border: 4px solid #000;
box-shadow: 4px 4px 0px 0px #000;
}
.border-brutal-sm {
border: 2px solid #000;
box-shadow: 2px 2px 0px 0px #000;
}
/* Interaction Classes */
.hard-btn {
transition: all 0.1s;
cursor: pointer;
user-select: none;
}
.hard-btn:active {
transform: translate(4px, 4px);
box-shadow: none !important;
}
.hard-btn:hover {
transform: translate(-2px, -2px);
box-shadow: 6px 6px 0px 0px #000;
}
/* Glitch Animation Keyframes */
@keyframes glitch {
0% { transform: translate(0); }
20% { transform: translate(-2px, 2px); }
40% { transform: translate(-2px, -2px); }
60% { transform: translate(2px, 2px); }
80% { transform: translate(2px, -2px); }
100% { transform: translate(0); }
}
.glitch-active {
animation: glitch 0.2s cubic-bezier(.25, .46, .45, .94) both infinite;
color: var(--acid-green);
}
/* Marquee */
.marquee-container {
overflow: hidden;
white-space: nowrap;
}
.marquee-content {
display: inline-block;
animation: marquee 15s linear infinite;
}
@keyframes marquee {
0% { transform: translateX(100%); }
100% { transform: translateX(-100%); }
}
/* Scanline Overlay */
.scanlines {
position: fixed;
top: 0; left: 0; width: 100vw; height: 100vh;
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
background-size: 100% 4px;
pointer-events: none;
z-index: 9999;
}
/* Typography */
.font-huge {
font-size: clamp(2rem, 8vw, 6rem);
line-height: 0.9;
}
.font-mono-xl {
font-size: 1.5rem;
letter-spacing: -0.05em;
}
/* Toast */
#toast-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 10000;
display: flex;
flex-direction: column;
gap: 10px;
}
.toast {
background: #fff;
border: 4px solid #000;
box-shadow: 6px 6px 0px 0px #000;
padding: 1rem;
font-weight: bold;
animation: slideIn 0.3s ease-out;
max-width: 300px;
}
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
</style>
</head>
<body class="antialiased min-h-screen relative">
<!-- Background Canvas -->
<canvas id="bgCanvas" class="fixed top-0 left-0 w-full h-full z-0 opacity-40"></canvas>
<!-- Scanline Effect -->
<div class="scanlines"></div>
<!-- Main Content -->
<div class="relative z-10 container mx-auto px-4 py-8 flex flex-col gap-12">
<!-- Header Section -->
<header class="border-brutal bg-yellow-300 p-6 flex flex-col md:flex-row justify-between items-start md:items-center gap-4 relative">
<!-- Decoration -->
<div class="absolute -top-4 -right-4 w-24 h-24 bg-cyan-400 border-4 border-black z-20 rotate-12 hidden md:block"></div>
<div class="absolute -bottom-4 -left-4 w-16 h-16 bg-hot-pink border-4 border-black z-20 -rotate-12 hidden md:block"></div>
<div>
<div class="text-xs font-bold uppercase bg-black text-white inline-block px-2 py-1 mb-2 tracking-widest">System Monitor v2.0</div>
<h1 class="font-huge font-black uppercase leading-none tracking-tighter mix-blend-difference">
Pattern<br>Adoption<br>Leaderboard
</h1>
<p class="mt-2 font-mono font-bold text-gray-900 max-w-md">
Real-time tracking of design system primitive shipments. <span class="text-red-600 animate-pulse">● LIVE DATA</span>
</p>
</div>
<div class="w-full md:w-auto">
<div class="border-brutal bg-white p-4">
<div class="text-xs font-bold mb-2 uppercase">Top Mover This Week</div>
<div class="flex items-center gap-3" id="top-mover-display">
<div class="w-12 h-12 bg-acid-green border-2 border-black flex items-center justify-center font-bold">?</div>
<div>
<div class="font-bold text-xl">---</div>
<div class="text-sm text-gray-600">+0% growth</div>
</div>
</div>
</div>
</div>
</header>
<!-- Marquee Banner -->
<div class="marquee-container border-brutal bg-black py-3 overflow-hidden">
<div class="marquee-content text-acid-green text-xl font-bold uppercase tracking-widest">
NEW ATOMIC PRIMITIVES SHIPPED: BUTTON-KNOCKOUT // INPUT-GLITCH // MODAL-DEBUG >> TEAM "NULL PTR" LEADS ADOPTION >> SCROLLING TEXT IS STILL COOL ??? >> YOUR MOM USES THE DESIGN SYSTEM >>
</div>
</div>
<!-- Key Metrics Row -->
<section class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="border-brutal bg-white p-6 relative group hard-btn">
<span class="absolute -top-4 -left-2 bg-acid-green border-2 border-black px-2 text-xs font-bold uppercase">Total Shipments</span>
<div class="text-5xl font-mono font-black mb-2 tabular-nums" id="total-shipments">0</div>
<div class="text-sm font-bold uppercase text-gray-500">Cumulative Deploys</div>
</div>
<div class="border-brutal bg-cyan-200 p-6 relative group hard-btn" style="box-shadow: 4px 4px 0px 0px #000;">
<span class="absolute -top-4 -left-2 bg-acid-green border-2 border-black px-2 text-xs font-bold uppercase">Active Teams</span>
<div class="text-5xl font-mono font-black mb-2 tabular-nums">12</div>
<div class="text-sm font-bold uppercase text-gray-500">Contributing Units</div>
</div>
<div class="border-brutal bg-hot-pink p-6 relative group hard-btn" style="box-shadow: 4px 4px 0px 0px #000;">
<span class="absolute -top-4 -left-2 bg-acid-green border-2 border-black px-2 text-xs font-bold uppercase">System Health</span>
<div class="text-5xl font-mono font-black mb-2 text-green-700">98.4%</div>
<div class="text-sm font-bold uppercase text-gray-500">Stable Diffusion</div>
</div>
</section>
<!-- Leaderboard Table -->
<section class="border-brutal bg-white overflow-hidden">
<div class="bg-black text-white p-4 border-b-4 border-black flex justify-between items-center">
<h2 class="text-xl font-black uppercase tracking-widest">Team Performance Metrics</h2>
<button onclick="shipRandomPattern()" class="bg-acid-green text-black font-bold px-4 py-2 border-2 border-black hard-btn text-sm uppercase">
[ SIMULATE DEPLOY ]
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="bg-yellow-300 border-b-4 border-black">
<th class="p-4 font-black uppercase text-sm md:text-base border-r border-black">Rank</th>
<th class="p-4 font-black uppercase text-sm md:text-base border-r border-black">Team Identity</th>
<th class="p-4 font-black uppercase text-sm md:text-base border-r border-black">Primitives Shipped</th>
<th class="p-4 font-black uppercase text-sm md:text-base border-r border-black">Total Usage (Instances)</th>
<th class="p-4 font-black uppercase text-sm md:text-base border-r border-black">Velocity (Δ/wk)</th>
<th class="p-4 font-black uppercase text-sm md:text-base text-right">Badges</th>
</tr>
</thead>
<tbody id="leaderboard-body">
<!-- Rows injected via JS -->
</tbody>
</table>
</div>
</section>
<!-- Footer / Credits -->
<footer class="border-t-4 border-black bg-gray-200 p-6 mt-8 flex justify-between items-center text-xs font-bold uppercase">
<div>Designed by the <span class="text-black bg-yellow-300 px-1">UX Anarchy</span> Collective</div>
<div class="hidden md:block">Rendering Engine: Human 1.0 :: Tailwind :: GSAP</div>
</footer>
</div>
<!-- Toast Container -->
<div id="toast-container"></div>
<!-- Scripts -->
<script>
// --- 1. Data & State ---
// Initial mock data
const teams = [
{ id: 1, name: "Team Glitch", color: "bg-acid-green", velocity: 12.5, count: 4520, patterns: 14, score: 98 },
{ id: 2, name: "The Nulls", color: "bg-black text-white", velocity: 9.8, count: 3200, patterns: 12, score: 85 },
{ id: 3, name: "Pixel Heros", color: "bg-cyan-400", velocity: 8.4, count: 2850, patterns: 9, score: 78 },
{ id: 4, name: "Brutalist JS", color: "bg-yellow-400", velocity: 6.2, count: 1900, patterns: 8, score: 65 },
{ id: 5, name: "Retro Wave", color: "bg-hot-pink", velocity: 5.1, count: 1500, patterns: 5, score: 54 },
{ id: 6, name: "Grid Masters", color: "bg-lime-300", velocity: 4.3, count: 1200, patterns: 6, score: 48 },
{ id: 7, name: "CSS Wizards", color: "bg-blue-300", velocity: 3.7, count: 950, patterns: 7, score: 42 },
{ id: 8, name: "Form Junkies", color: "bg-gray-400", velocity: 2.1, count: 600, patterns: 3, score: 28 },
];
// Icons (SVG strings)
const crownIcon = `<svg class="w-6 h-6 text-yellow-500" fill="currentColor" viewBox="0 0 20 20"><path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/></svg>`;
const fireIcon = `<svg class="w-6 h-6 text-red-500" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M12 7a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0V8.414l-4.586 4.586a1 1 0 01-1.414 0L8 10.586l-4.586 4.586a1 1 0 01-1.414-1.414l5-5a1 1 0 011.414 0L11 10.586 14.586 7H12z" clip-rule="evenodd"/></svg>`;
const rockIcon = `<svg class="w-6 h-6 text-gray-800" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clip-rule="evenodd"/></svg>`;
// --- 2. DOM Elements ---
const tableBody = document.getElementById('leaderboard-body');
const totalShipmentsEl = document.getElementById('total-shipments');
const topMoverEl = document.getElementById('top-mover-display');
const toastContainer = document.getElementById('toast-container');
// --- 3. Functions ---
function formatNumber(num) {
return new Intl.NumberFormat('en-US').format(num);
}
function renderLeaderboard() {
// Sort by count (usage)
teams.sort((a, b) => b.count - a.count);
tableBody.innerHTML = '';
teams.forEach((team, index) => {
const rank = index + 1;
const tr = document.createElement('tr');
tr.className = `border-b border-black hover:bg-gray-100 transition-colors group`;
// Row styling based on rank parity (just to add chaos/brutalism)
if (rank % 2 === 0) {
tr.classList.add('bg-white');
} else {
tr.classList.add('bg-gray-50');
}
// Badges logic
let badgesHtml = '';
if (rank === 1) badgesHtml = `<span title="Leader">${crownIcon}</span>`;
if (team.velocity > 8) badgesHtml += `<span title="High Velocity" class="ml-1">${fireIcon}</span>`;
if (team.patterns < 4) badgesHtml += `<span title="Basic Bitch" class="ml-1">${rockIcon}</span>`;
tr.innerHTML = `
<td class="p-4 font-black text-2xl text-center border-r border-black w-20 ${rank <= 3 ? 'text-yellow-600' : ''}">#${rank}</td>
<td class="p-4 font-bold text-lg border-r border-black">
<div class="flex items-center gap-3">
<div class="w-10 h-10 border-2 border-black bg-gray-200 flex items-center justify-center font-bold text-sm shrink-0">
${team.name.substring(0,2).toUpperCase()}
</div>
<span class="font-mono font-bold">${team.name}</span>
</div>
</td>
<td class="p-4 font-mono font-bold text-lg border-r border-black text-center">
<span class="bg-black text-white px-2 py-1 text-sm border border-white">${team.patterns}</span>
</td>
<td class="p-4 font-huge font-mono font-black text-3xl border-r border-black text-right tabular-nums tracking-tighter">
${formatNumber(team.count)}
</td>
<td class="p-4 font-mono font-bold text-lg border-r border-black text-center" style="color: ${team.velocity > 0 ? 'green' : 'red'}">
${team.velocity > 0 ? '+' : ''}${team.velocity}%
</td>
<td class="p-4 text-right border-l-4 border-black bg-yellow-50">
<div class="flex justify-end gap-1">${badgesHtml}</div>
</td>
`;
tableBody.appendChild(tr);
});
// Update Top Mover
const top = teams[0];
topMoverEl.innerHTML = `
<div class="w-12 h-12 ${top.color} border-2 border-black flex items-center justify-center font-bold">${top.name.substring(0,1)}</div>
<div>
<div class="font-bold text-xl">${top.name}</div>
<div class="text-sm font-bold" style="color: ${top.color === 'bg-black' ? 'white' : 'black'}">Velocity: +${top.velocity}%</div>
</div>
`;
// Update Total Shipments (sum of all counts)
totalShipmentsEl.innerText = formatNumber(teams.reduce((acc, t) => acc + t.count, 0));
}
function showToast(message) {
const toast = document.createElement('div');
toast.className = 'toast border-brutal bg-white';
toast.innerHTML = `
<div class="flex items-center gap-2">
<div class="w-3 h-3 bg-black"></div>
<span class="font-bold uppercase">Alert</span>
</div>
<p class="mt-2 text-sm">${message}</p>
<button class="mt-3 bg-black text-white w-full py-1 border border-white font-bold uppercase text-xs" onclick="this.parentElement.remove()">Dismiss</button>
`;
toastContainer.appendChild(toast);
// Auto remove
setTimeout(() => {
toast.style.opacity = '0';
setTimeout(() => toast.remove(), 300);
}, 4000);
}
function shipRandomPattern() {
// Simulate a team shipping something
const randomTeamIdx = Math.floor(Math.random() * teams.length);
const team = teams[randomTeamIdx];
const increment = Math.floor(Math.random() * 100) + 10;
team.count += increment;
// Slightly adjust velocity
team.velocity = Math.min(20, Math.max(-5, team.velocity + (Math.random() * 2 - 1)));
// Re-render
renderLeaderboard();
// Visual feedback: Glitch the table or button
const btn = document.querySelector('button[onclick="shipRandomPattern()"]');
btn.classList.add('glitch-active');
setTimeout(() => btn.classList.remove('glitch-active'), 500);
showToast(`[DEPLOYMENT ALERT] <strong>${team.name}</strong> shipped a new primitive! <br> Usage instances increased by <strong>+${increment}</strong>`);
}
// --- 4. Canvas Background (Retro Grid + Noise) ---
const canvas = document.getElementById('bgCanvas');
const ctx = canvas.getContext('2d');
let width, height;
function resize() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
const particles = [];
for(let i=0; i<50; i++) {
particles.push({
x: Math.random() * window.innerWidth,
y: Math.random() * window.innerHeight,
w: Math.random() * 50 + 10,
h: Math.random() * 50 + 10,
speedX: (Math.random() - 0.5) * 1,
speedY: (Math.random() - 0.5) * 1,
color: Math.random() > 0.5 ? 'rgba(255, 0, 255, 0.1)' : 'rgba(0, 255, 255, 0.1)'
});
}
function drawCanvas() {
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, width, height); // White background
ctx.lineWidth = 2;
// Draw grid
ctx.beginPath();
ctx.strokeStyle = 'rgba(0,0,0,0.1)';
const gridSize = 40;
for (let x = 0; x <= width; x += gridSize) {
ctx.moveTo(x, 0);
ctx.lineTo(x, height);
}
for (let y = 0; y <= height; y += gridSize) {
ctx.moveTo(0, y);
ctx.lineTo(width, y);
}
ctx.stroke();
// Draw moving rectangles (floating divs)
particles.forEach(p => {
p.x += p.speedX;
p.y += p.speedY;
if(p.x < 0 || p.x > width) p.speedX *= -1;
if(p.y < 0 || p.y > height) p.speedY *= -1;
ctx.fillStyle = p.color;
ctx.fillRect(p.x, p.y, p.w, p.h);
ctx.strokeRect(p.x, p.y, p.w, p.h);
});
requestAnimationFrame(drawCanvas);
}
drawCanvas();
// --- 5. GSAP Animations ---
// Stagger entry of table rows
window.addEventListener('load', () => {
gsap.from("header", { y: -50, opacity: 0, duration: 1, ease: "power4.out" });
gsap.from(".border-brutal-sm, .font-huge", { scale: 0.8, opacity: 0, duration: 0.6, stagger: 0.1, ease: "back.out(1.7)" });
});
// Title Glitch Effect on Hover
const title = document.querySelector('h1');
title.addEventListener('mouseenter', () => {
gsap.to(title, {
skewX: 10,
scale: 1.02,
color: "#000",
duration: 0.1,
yoyo: true,
repeat: 5,
onComplete: () => {
gsap.to(title, { skewX: 0, scale: 1, duration: 0.2 });
}
});
});
// --- 6. Initialization ---
renderLeaderboard();
// Simulation loop: Randomly increment a team every few seconds to show "live" nature
setInterval(() => {
if(Math.random() > 0.5) {
shipRandomPattern();
}
}, 5000);
</script>
</body>
</html>