Design a UI flourish library balancing delight animations with CPU budgets,…
- User
Design a UI flourish library balancing delight animations with CPU budgets, accessibility, and toggle controls.
Assistant
The user wants a UI flourish library that demonstrates delightful animations while being mindful of:
- CPU budgets - performant animations
- Accessibility - respects prefers-reduced-motion, keyboard navigation, ARIA
- Toggle controls - ability to enable/disable flourishes
This is a technical showcase/library demo, so I'll create an interactive page that:
- Shows various flourish animation types (buttons, cards, notifications, loaders, etc.)
- Has a control panel to toggle animations on/off
- Shows CPU usage indicator or performance metrics
- Respects prefers-reduced-motion
- Has keyboard accessible controls
Let me design something that's:
- Professional and technical looking (not a landing page)
- Dark theme with good contrast
- Shows code-like elements or technical aesthetic
- Multiple interactive flourish examples
- Real-time performance monitoring
Design direction:
- Dark, technical/developer tool aesthetic
- Monospace fonts for code-like feel, clean sans-serif for UI
- Accent color: maybe a bright cyan or green (terminal-like)
- Grid/matrix background pattern
- Clean, organized sections for different flourish types
Flourish categories to showcase:
- Button interactions (ripple, scale, glow)
- Card hover effects (lift, shine, border animation)
- Loading states (skeleton, spinners, progress)
- Notification toasts (slide in, bounce)
- Toggle/checkbox animations
- Focus states (outline animations)
- Text reveals
- Particle effects (subtle, controlled)
I'll create a comprehensive demo with:
- A settings panel to toggle animations globally or by category
- Performance monitor showing FPS
- Reduced motion toggle
- Individual flourish demos with code hints
- Real interactivity
UI Flourish Library Design
I'll create a comprehensive, technical-aesthetic flourish library showcase with performance monitoring, accessibility controls, and various animation categories. The design uses a dark developer-tool theme with a vibrant accent color.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Flourish UI Library</title> <script src="https://cdn.tailwindcss.com"></script> <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=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap" rel="stylesheet"> <style> :root { --bg: #0a0a0f; --bg-elevated: #12121a; --card: #16161f; --border: #2a2a3a; --fg: #e8e8ed; --muted: #6b6b7a; --accent: #00e5a0; --accent-dim: rgba(0, 229, 160, 0.15); --danger: #ff4d6a; --warning: #ffb84d; } * { box-sizing: border-box; } body { font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; } .font-mono { font-family: 'JetBrains Mono', monospace; } /* Background pattern */ .bg-pattern { background-image: radial-gradient(circle at 20% 80%, rgba(0, 229, 160, 0.05) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(0, 229, 160, 0.03) 0%, transparent 50%), linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px); background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px; } /* Reduced motion base */ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } } .flourish-disabled * { animation: none !important; transition: none !important; } /* Performance toggle switch */ .toggle-track { width: 44px; height: 24px; background: var(--border); border-radius: 12px; position: relative; cursor: pointer; transition: background 0.2s ease; } .toggle-track[data-active="true"] { background: var(--accent); } .toggle-thumb { width: 18px; height: 18px; background: var(--fg); border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: transform 0.2s ease, background 0.2s ease; } .toggle-track[data-active="true"] .toggle-thumb { transform: translateX(20px); background: var(--bg); } /* Flourish buttons */ .flourish-btn { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--border); color: var(--fg); padding: 12px 24px; border-radius: 8px; font-weight: 500; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; } .flourish-btn:hover { border-color: var(--accent); box-shadow: 0 0 20px rgba(0, 229, 160, 0.15); } .flourish-btn:active { transform: scale(0.97); } .flourish-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } /* Ripple effect */ .ripple { position: absolute; border-radius: 50%; background: rgba(0, 229, 160, 0.4); transform: scale(0); animation: ripple-anim 0.6s ease-out forwards; pointer-events: none; } @keyframes ripple-anim { to { transform: scale(4); opacity: 0; } } /* Shine effect on cards */ .flourish-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; position: relative; overflow: hidden; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; } .flourish-card::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(0, 229, 160, 0.08), transparent); transition: left 0.5s ease; } .flourish-card:hover { transform: translateY(-4px); border-color: rgba(0, 229, 160, 0.3); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); } .flourish-card:hover::before { left: 100%; } /* Pulse loader */ .pulse-loader { display: flex; gap: 6px; } .pulse-loader span { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 1.2s ease-in-out infinite; } .pulse-loader span:nth-child(2) { animation-delay: 0.2s; } .pulse-loader span:nth-child(3) { animation-delay: 0.4s; } @keyframes pulse { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } } /* Skeleton loader */ .skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--card) 50%, var(--border) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; border-radius: 4px; } @keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } } /* Toast notification */ .toast { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; display: flex; align-items: center; gap: 12px; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4); } .toast.show { transform: translateX(0); } /* Counter animation */ .counter { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); } /* Stagger reveal */ .stagger-item { opacity: 0; transform: translateY(20px); transition: opacity 0.4s ease, transform 0.4s ease; } .stagger-item.revealed { opacity: 1; transform: translateY(0); } /* Focus glow */ .focus-glow:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px rgba(0, 229, 160, 0.3); border-color: var(--accent); } /* FPS counter */ .fps-badge { font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 4px 8px; border-radius: 4px; background: var(--card); border: 1px solid var(--border); } .fps-good { color: var(--accent); } .fps-warn { color: var(--warning); } .fps-bad { color: var(--danger); } /* Checkbox flourish */ .flourish-checkbox { width: 24px; height: 24px; border: 2px solid var(--border); border-radius: 6px; cursor: pointer; position: relative; transition: border-color 0.2s ease, background 0.2s ease; } .flourish-checkbox[data-checked="true"] { background: var(--accent); border-color: var(--accent); } .flourish-checkbox svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); stroke: var(--bg); } .flourish-checkbox[data-checked="true"] svg { transform: translate(-50%, -50%) scale(1); } /* Progress bar */ .progress-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; } .progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #00ffcc); border-radius: 4px; transition: width 0.3s ease; } /* Floating label input */ .flourish-input-group { position: relative; } .flourish-input { width: 100%; padding: 16px 12px 8px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--fg); font-size: 16px; transition: border-color 0.2s ease, box-shadow 0.2s ease; } .flourish-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); } .flourish-label { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: top 0.2s ease, font-size 0.2s ease, color 0.2s ease; } .flourish-input:focus + .flourish-label, .flourish-input:not(:placeholder-shown) + .flourish-label { top: 8px; font-size: 12px; color: var(--accent); } /* Morphing icon */ .morph-icon { width: 48px; height: 48px; background: var(--accent-dim); border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s ease, transform 0.2s ease; } .morph-icon:hover { background: var(--accent); transform: rotate(90deg); } .morph-icon svg { stroke: var(--accent); transition: stroke 0.2s ease; } .morph-icon:hover svg { stroke: var(--bg); } /* Scroll indicator */ @keyframes scroll-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } } .scroll-indicator { animation: scroll-bounce 1.5s ease-in-out infinite; } /* Badge pulse */ .badge-pulse { position: relative; } .badge-pulse::after { content: ''; position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; } .badge-pulse::before { content: ''; position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; animation: badge-ring 1.5s ease-out infinite; } @keyframes badge-ring { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } } /* Section reveal */ .section-reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; } .section-reveal.visible { opacity: 1; transform: translateY(0); } </style> </head> <body class="bg-pattern"> <!-- Header --> <header class="fixed top-0 left-0 right-0 z-50 backdrop-blur-md bg-[var(--bg)]/80 border-b border-[var(--border)]"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div class="flex items-center justify-between h-16"> <div class="flex items-center gap-3"> <div class="w-8 h-8 rounded-lg bg-[var(--accent)] flex items-center justify-center"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--bg)" stroke-width="2.5"> <path d="M12 2L2 7l10 5 10-5-10-5z"/> <path d="M2 17l10 5 10-5"/> <path d="M2 12l10 5 10-5"/> </svg> </div> <span class="font-bold text-lg">Flourish UI</span> <span class="font-mono text-xs text-[var(--muted)] hidden sm:block">v2.4.0</span> </div> <div class="flex items-center gap-4"> <div class="fps-badge flex items-center gap-2"> <span class="text-[var(--muted)]">FPS:</span> <span id="fps-counter" class="fps-good">60</span> </div> <button id="global-toggle" class="flex items-center gap-2 text-sm" aria-label="Toggle all animations" > <span class="hidden sm:block text-[var(--muted)]">Animations</span> <div class="toggle-track" data-active="true" role="switch" aria-checked="true" tabindex="0"> <div class="toggle-thumb"></div> </div> </button> </div> </div> </div> </header> <main id="main-content" class="pt-24 pb-16"> <!-- Hero Section --> <section class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16"> <div class="text-center mb-12 section-reveal"> <h1 class="text-4xl sm:text-5xl lg:text-6xl font-bold mb-4 tracking-tight"> Delightful Motion,<br/> <span class="text-[var(--accent)]">Responsible Design</span> </h1> <p class="text-lg text-[var(--muted)] max-w-2xl mx-auto"> A flourish library built for performance budgets, full accessibility compliance, and granular toggle controls. </p> </div> <!-- Performance Dashboard --> <div class="flourish-card mb-8 section-reveal" style="transition-delay: 0.1s"> <div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6"> <div> <h2 class="font-bold text-lg mb-1">Performance Budget</h2> <p class="text-sm text-[var(--muted)]">Real-time CPU and animation metrics</p> </div> <div class="flex items-center gap-4"> <div class="text-center"> <div class="font-mono text-2xl font-bold text-[var(--accent)]" id="active-animations">0</div> <div class="text-xs text-[var(--muted)]">Active</div> </div> <div class="w-px h-10 bg-[var(--border)]"></div> <div class="text-center"> <div class="font-mono text-2xl font-bold" id="cpu-estimate">2%</div> <div class="text-xs text-[var(--muted)]">CPU Est.</div> </div> </div> </div> <div class="grid grid-cols-2 sm:grid-cols-4 gap-4"> <div class="bg-[var(--bg)] rounded-lg p-4"> <div class="text-xs text-[var(--muted)] mb-1 font-mono">TRANSITIONS</div> <div class="flex items-center justify-between"> <span class="font-medium">Enabled</span> <div class="toggle-track toggle-sm" data-active="true" data-category="transitions" role="switch" tabindex="0"> <div class="toggle-thumb"></div> </div> </div> </div> <div class="bg-[var(--bg)] rounded-lg p-4"> <div class="text-xs text-[var(--muted)] mb-1 font-mono">KEYFRAMES</div> <div class="flex items-center justify-between"> <span class="font-medium">Enabled</span> <div class="toggle-track toggle-sm" data-active="true" data-category="keyframes" role="switch" tabindex="0"> <div class="toggle-thumb"></div> </div> </div> </div> <div class="bg-[var(--bg)] rounded-lg p-4"> <div class="text-xs text-[var(--muted)] mb-1 font-mono">PARTICLES</div> <div class="flex items-center justify-between"> <span class="font-medium">Enabled</span> <div class="toggle-track toggle-sm" data-active="true" data-category="particles" role="switch" tabindex="0"> <div class="toggle-thumb"></div> </div> </div> </div> <div class="bg-[var(--bg)] rounded-lg p-4"> <div class="text-xs text-[var(--muted)] mb-1 font-mono">MORPHS</div> <div class="flex items-center justify-between"> <span class="font-medium">Enabled</span> <div class="toggle-track toggle-sm" data-active="true" data-category="morphs" role="switch" tabindex="0"> <div class="toggle-thumb"></div> </div> </div> </div> </div> </div> <!-- Accessibility Controls --> <div class="flourish-card bg-[var(--bg-elevated)] section-reveal" style="transition-delay: 0.2s"> <div class="flex items-center gap-3 mb-4"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2"> <circle cx="12" cy="12" r="10"/> <circle cx="12" cy="10" r="3"/> <path d="M12 13v6"/> <path d="M9 18h6"/> </svg> <h3 class="font-bold">Accessibility Settings</h3> </div> <div class="grid sm:grid-cols-3 gap-4"> <label class="flex items-center gap-3 cursor-pointer"> <div class="flourish-checkbox" data-checked="false" role="checkbox" tabindex="0" aria-checked="false"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke-width="3"> <polyline points="20 6 9 17 4 12"/> </svg> </div> <span class="text-sm">Respect prefers-reduced-motion</span> </label> <label class="flex items-center gap-3 cursor-pointer"> <div class="flourish-checkbox" data-checked="true" role="checkbox" tabindex="0" aria-checked="true"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke-width="3"> <polyline points="20 6 9 17 4 12"/> </svg> </div> <span class="text-sm">Enhanced focus indicators</span> </label> <label class="flex items-center gap-3 cursor-pointer"> <div class="flourish-checkbox" data-checked="true" role="checkbox" tabindex="0" aria-checked="true"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke-width="3"> <polyline points="20 6 9 17 4 12"/> </svg> </div> <span class="text-sm">Pause on blur</span> </label> </div> </div> </section> <!-- Flourish Categories --> <section class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div class="grid lg:grid-cols-2 gap-6"> <!-- Button Effects --> <div class="flourish-card section-reveal" style="transition-delay: 0.3s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Button Effects</h3> <p class="text-sm text-[var(--muted)]">Click, hover, and focus states</p> </div> <span class="font-mono text-xs text-[var(--accent)] bg-[var(--accent-dim)] px-2 py-1 rounded">TRANSITIONS</span> </div> <div class="flex flex-wrap gap-3"> <button class="flourish-btn focus-glow" data-flourish="ripple"> Ripple Effect </button> <button class="flourish-btn focus-glow" data-flourish="scale" style="transition: transform 0.15s ease;"> Scale Press </button> <button class="flourish-btn focus-glow bg-[var(--accent)] text-[var(--bg)] border-[var(--accent)]"> Primary Action </button> </div> <div class="mt-4 p-3 bg-[var(--bg)] rounded-lg"> <code class="font-mono text-xs text-[var(--muted)]"> CPU: ~0.1ms/frame | GPU: compositor only </code> </div> </div> <!-- Card Interactions --> <div class="flourish-card section-reveal" style="transition-delay: 0.4s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Card Interactions</h3> <p class="text-sm text-[var(--muted)]">Hover lift with shine sweep</p> </div> <span class="font-mono text-xs text-[var(--accent)] bg-[var(--accent-dim)] px-2 py-1 rounded">TRANSFORMS</span> </div> <div class="grid grid-cols-2 gap-3"> <div class="flourish-card p-4 text-center cursor-pointer"> <div class="w-10 h-10 mx-auto mb-2 rounded-lg bg-[var(--accent-dim)] flex items-center justify-center"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2"> <path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/> </svg> </div> <div class="font-medium text-sm">Pricing</div> </div> <div class="flourish-card p-4 text-center cursor-pointer"> <div class="w-10 h-10 mx-auto mb-2 rounded-lg bg-[var(--accent-dim)] flex items-center justify-center"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2"> <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/> <circle cx="9" cy="7" r="4"/> <path d="M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"/> </svg> </div> <div class="font-medium text-sm">Team</div> </div> </div> </div> <!-- Loading States --> <div class="flourish-card section-reveal" style="transition-delay: 0.5s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Loading States</h3> <p class="text-sm text-[var(--muted)]">Skeleton, pulse, progress</p> </div> <span class="font-mono text-xs text-[var(--warning)] bg-[rgba(255,184,77,0.15)] px-2 py-1 rounded">KEYFRAMES</span> </div> <div class="space-y-4"> <div> <div class="text-xs text-[var(--muted)] mb-2 font-mono">PULSE LOADER</div> <div class="pulse-loader"> <span></span><span></span><span></span> </div> </div> <div> <div class="text-xs text-[var(--muted)] mb-2 font-mono">SKELETON</div> <div class="space-y-2"> <div class="skeleton h-4 w-3/4"></div> <div class="skeleton h-4 w-full"></div> <div class="skeleton h-4 w-1/2"></div> </div> </div> <div> <div class="text-xs text-[var(--muted)] mb-2 font-mono">PROGRESS</div> <div class="progress-track"> <div class="progress-fill" id="progress-demo" style="width: 0%"></div> </div> </div> </div> <button class="flourish-btn mt-4 w-full" id="start-progress">Start Progress Demo</button> </div> <!-- Notification Toasts --> <div class="flourish-card section-reveal" style="transition-delay: 0.6s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Notifications</h3> <p class="text-sm text-[var(--muted)]">Animated toast system</p> </div> <span class="font-mono text-xs text-[var(--accent)] bg-[var(--accent-dim)] px-2 py-1 rounded">TRANSITIONS</span> </div> <div class="space-y-3"> <button class="flourish-btn w-full" id="toast-success"> <span class="flex items-center justify-center gap-2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/> <polyline points="22 4 12 14.01 9 11.01"/> </svg> Success Toast </span> </button> <button class="flourish-btn w-full" id="toast-error"> <span class="flex items-center justify-center gap-2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <circle cx="12" cy="12" r="10"/> <line x1="15" y1="9" x2="9" y2="15"/> <line x1="9" y1="9" x2="15" y2="15"/> </svg> Error Toast </span> </button> </div> </div> <!-- Form Interactions --> <div class="flourish-card section-reveal" style="transition-delay: 0.7s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Form Interactions</h3> <p class="text-sm text-[var(--muted)]">Floating labels, focus states</p> </div> <span class="font-mono text-xs text-[var(--accent)] bg-[var(--accent-dim)] px-2 py-1 rounded">TRANSITIONS</span> </div> <div class="space-y-4"> <div class="flourish-input-group"> <input type="text" class="flourish-input focus-glow" placeholder=" " id="demo-email"> <label class="flourish-label" for="demo-email">Email address</label> </div> <div class="flourish-input-group"> <input type="password" class="flourish-input focus-glow" placeholder=" " id="demo-password"> <label class="flourish-label" for="demo-password">Password</label> </div> </div> </div> <!-- Icon Morphs --> <div class="flourish-card section-reveal" style="transition-delay: 0.8s"> <div class="flex items-center justify-between mb-6"> <div> <h3 class="font-bold mb-1">Icon Morphs</h3> <p class="text-sm text-[var(--muted)]">Transform on interaction</p> </div> <span class="font-mono text-xs text-[var(--danger)] bg-[rgba(255,77,106,0.15)] px-2 py-1 rounded">MORPHS</span> </div> <div class="flex gap-3"> <div class="morph-icon" role="button" tabindex="0" aria-label="Settings"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2"> <circle cx="12" cy="12" r="3"/> <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/> </svg> </div> <div class="morph-icon" role="button" tabindex="0" aria-label="Add"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2"> <line x1="12" y1="5" x2="12" y2="19"/> <line x1="5" y1="12" x2="19" y2="12"/> </svg> </div> <div class="morph-icon" role="button" tabindex="0" aria-label="Search"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2"> <circle cx="11" cy="11" r="8"/> <line x1="21" y1="21" x2="16.65" y2="16.65"/> </svg> </div> <div class="morph-icon badge-pulse" role="button" tabindex="0" aria-label="Notifications"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2"> <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/> <path d="M13.73 21a2 2 0 0 1-3.46 0"/> </svg> </div> </div> <div class="mt-4 p-3 bg-[var(--bg)] rounded-lg"> <code class="font-mono text-xs text-[var(--muted)]"> Uses transform only - no layout thrash </code> </div> </div> </div> <!-- Counter Animation --> <div class="flourish-card mt-6 section-reveal" style="transition-delay: 0.9s"> <div class="flex flex-col sm:flex-row items-center justify-between gap-6"> <div> <h3 class="font-bold mb-1">Animated Counter</h3> <p class="text-sm text-[var(--muted)]">Smooth number transitions</p> </div> <div class="flex items-center gap-6"> <div class="text-center"> <div class="counter" data-target="10000" data-current="0">0</div> <div class="text-xs text-[var(--muted)] font-mono">USERS</div> </div> <div class="text-center"> <div class="counter" data-target="99.9" data-current="0" data-suffix="%">0%</div> <div class="text-xs text-[var(--muted)] font-mono">UPTIME</div> </div> <div class="text-center"> <div class="counter" data-target="2.4" data-current="0" data-suffix="ms" data-decimals="1">0ms</div> <div class="text-xs text-[var(--muted)] font-mono">P95 LATENCY</div> </div> </div> <button class="flourish-btn" id="animate-counters">Animate</button> </div> </div> <!-- Stagger Grid --> <div class="mt-6 section-reveal" style="transition-delay: 1s"> <div class="flex items-center justify-between mb-4"> <div> <h3 class="font-bold">Stagger Reveal Grid</h3> <p class="text-sm text-[var(--muted)]">IntersectionObserver-triggered entrance</p> </div> <button class="flourish-btn" id="reset-stagger">Reset</button> </div> <div class="grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-6 gap-3" id="stagger-grid"> <!-- Items generated by JS --> </div> </div> </section> </main> <!-- Toast Container --> <div id="toast-container" class="fixed bottom-4 right-4 z-50 space-y-3" aria-live="polite" aria-label="Notifications"></div> <script> // State const state = { animationsEnabled: true, categories: { transitions: true, keyframes: true, particles: true, morphs: true }, reducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches, activeAnimations: 0, frameCount: 0, lastTime: performance.now(), fps: 60 }; // FPS Counter function updateFPS() { const now = performance.now(); state.frameCount++; if (now - state.lastTime >= 1000) { state.fps = Math.round(state.frameCount * 1000 / (now - state.lastTime)); state.frameCount = 0; state.lastTime = now; const fpsEl = document.getElementById('fps-counter'); if (fpsEl) { fpsEl.textContent = state.fps; fpsEl.className = state.fps >= 55 ? 'fps-good' : state.fps >= 30 ? 'fps-warn' : 'fps-bad'; } } requestAnimationFrame(updateFPS); } requestAnimationFrame(updateFPS); // Update active animations counter function updateActiveCount() { const el = document.getElementById('active-animations'); if (el) el.textContent = state.activeAnimations; const cpuEl = document.getElementById('cpu-estimate'); if (cpuEl) { const cpuEst = Math.min(100, Math.round(state.activeAnimations * 0.5 + (60 - state.fps) * 0.3)); cpuEl.textContent = cpuEst + '%'; } } // Toggle handlers function setupToggles() { // Global toggle const globalToggle = document.querySelector('#global-toggle .toggle-track'); if (globalToggle) { globalToggle.addEventListener('click', () => { state.animationsEnabled = !state.animationsEnabled; globalToggle.dataset.active = state.animationsEnabled; globalToggle.setAttribute('aria-checked', state.animationsEnabled); document.body.classList.toggle('flourish-disabled', !state.animationsEnabled); }); globalToggle.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); globalToggle.click(); } }); } // Category toggles document.querySelectorAll('.toggle-track[data-category]').forEach(toggle => { toggle.addEventListener('click', () => { const category = toggle.dataset.category; state.categories[category] = !state.categories[category]; toggle.dataset.active = state.categories[category]; toggle.setAttribute('aria-checked', state.categories[category]); }); toggle.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggle.click(); } }); }); // Checkboxes document.querySelectorAll('.flourish-checkbox').forEach(checkbox => { checkbox.addEventListener('click', () => { const isChecked = checkbox.dataset.checked === 'true'; checkbox.dataset.checked = !isChecked; checkbox.setAttribute('aria-checked', !isChecked); }); checkbox.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); checkbox.click(); } }); }); } // Ripple effect function setupRipple() { document.querySelectorAll('[data-flourish="ripple"]').forEach(btn => { btn.addEventListener('click', function(e) { if (!state.animationsEnabled || !state.categories.transitions) return; const rect = this.getBoundingClientRect(); const ripple = document.createElement('span'); ripple.className = 'ripple'; const size = Math.max(rect.width, rect.height); ripple.style.width = ripple.style.height = size + 'px'; ripple.style.left = (e.clientX - rect.left - size / 2) + 'px'; ripple.style.top = (e.clientY - rect.top - size / 2) + 'px'; this.appendChild(ripple); state.activeAnimations++; updateActiveCount(); ripple.addEventListener('animationend', () => { ripple.remove(); state.activeAnimations--; updateActiveCount(); }); }); }); } // Toast notifications function showToast(message, type = 'success') { const container = document.getElementById('toast-container'); if (!container) return; const toast = document.createElement('div'); toast.className = 'toast'; toast.setAttribute('role', 'alert'); const iconColor = type === 'success' ? 'var(--accent)' : 'var(--danger)'; const icon = type === 'success' ? '<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/>' : '<circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/>'; toast.innerHTML = ` <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="${iconColor}" stroke-width="2">${icon}</svg> <span>${message}</span> <button class="ml-auto p-1 hover:opacity-70" aria-label="Dismiss"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/> </svg> </button> `; container.appendChild(toast); // Trigger animation requestAnimationFrame(() => { toast.classList.add('show'); }); const dismiss = () => { toast.classList.remove('show'); setTimeout(() => toast.remove(), 300); }; toast.querySelector('button').addEventListener('click', dismiss); setTimeout(dismiss, 4000); } function setupToastButtons() { const successBtn = document.getElementById('toast-success'); if (successBtn) { successBtn.addEventListener('click', () => { showToast('Changes saved successfully!', 'success'); }); } const errorBtn = document.getElementById('toast-error'); if (errorBtn) { errorBtn.addEventListener('click', () => { showToast('Something went wrong. Please try again.', 'error'); }); } } // Progress bar demo function setupProgress() { const btn = document.getElementById('start-progress'); const bar = document.getElementById('progress-demo'); if (btn && bar) { btn.addEventListener('click', () => { bar.style.width = '0%'; let progress = 0; const interval = setInterval(() => { if (!state.animationsEnabled || !state.categories.keyframes) { clearInterval(interval); return; } progress += Math.random() * 15; if (progress >= 100) { progress = 100; clearInterval(interval); } bar.style.width = progress + '%'; }, 200); }); } } // Counter animation function setupCounters() { const btn = document.getElementById('animate-counters'); if (!btn) return; btn.addEventListener('click', () => { if (!state.animationsEnabled || !state.categories.transitions) return; document.querySelectorAll('.counter').forEach(counter => { const target = parseFloat(counter.dataset.target) || 0; const suffix = counter.dataset.suffix || ''; const decimals = parseInt(counter.dataset.decimals) || 0; const duration = 2000; const start = performance.now(); state.activeAnimations++; updateActiveCount(); function update(now) { const elapsed = now - start; const progress = Math.min(elapsed / duration, 1); const eased = 1 - Math.pow(1 - progress, 4); const current = target * eased; counter.textContent = current.toFixed(decimals) + suffix; if (progress < 1) { requestAnimationFrame(update); } else { state.activeAnimations--; updateActiveCount(); } } requestAnimationFrame(update); }); }); } // Stagger grid function setupStaggerGrid() { const grid = document.getElementById('stagger-grid'); if (!grid) return; // Generate items const colors = ['#00e5a0', '#00ffcc', '#00ccff', '#9966ff', '#ff6699', '#ffcc00']; for (let i = 0; i < 12; i++) { const item = document.createElement('div'); item.className = 'stagger-item flourish-card p-4 text-center cursor-pointer'; item.style.transitionDelay = (i * 0.05) + 's'; item.innerHTML = ` <div class="w-8 h-8 mx-auto mb-2 rounded-lg" style="background: ${colors[i % colors.length]}20; border: 1px solid ${colors[i % colors.length]}40"></div> <div class="font-mono text-xs text-[var(--muted)]">Item ${i + 1}</div> `; grid.appendChild(item); } // Intersection Observer const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting && state.animationsEnabled && state.categories.transitions) { entry.target.classList.add('revealed'); } }); }, { threshold: 0.1 }); grid.querySelectorAll('.stagger-item').forEach(item => observer.observe(item)); // Reset button const resetBtn = document.getElementById('reset-stagger'); if (resetBtn) { resetBtn.addEventListener('click', () => { grid.querySelectorAll('.stagger-item').forEach(item => { item.classList.remove('revealed'); }); }); } } // Section reveal function setupSectionReveal() { const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting && state.animationsEnabled) { entry.target.classList.add('visible'); } }); }, { threshold: 0.1 }); document.querySelectorAll('.section-reveal').forEach(section => { observer.observe(section); }); } // Scale button effect function setupScaleButtons() { document.querySelectorAll('[data-flourish="scale"]').forEach(btn => { btn.addEventListener('mousedown', function() { if (state.animationsEnabled && state.categories.transitions) { this.style.transform = 'scale(0.95)'; } }); btn.addEventListener('mouseup', function() { this.style.transform = ''; }); btn.addEventListener('mouseleave', function() { this.style.transform = ''; }); }); } // Pause on blur function setupBlurPause() { document.addEventListener('visibilitychange', () => { if (document.hidden) { document.body.classList.add('paused'); } else { document.body.classList.remove('paused'); } }); } // Initialize document.addEventListener('DOMContentLoaded', () => { setupToggles(); setupRipple(); setupToastButtons(); setupProgress(); setupCounters(); setupStaggerGrid(); setupSectionReveal(); setupScaleButtons(); setupBlurPause(); // Initial reveal setTimeout(() => { document.querySelectorAll('.section-reveal').forEach(section => { section.classList.add('visible'); }); }, 100); }); </script> </body> </html>Key Features
Performance Controls
- Real-time FPS counter in the header with color-coded health indicators
- CPU estimate based on active animation count
- Category-based toggles to disable specific animation types (transitions, keyframes, particles, morphs)
- Global kill switch to disable all animations instantly
Accessibility
- Full keyboard navigation support (Enter/Space for toggles)
- ARIA attributes on all interactive elements (role="switch", aria-checked)
- prefers-reduced-motion checkbox to respect system settings
- Pause on blur - animations pause when tab loses focus
- Focus-visible states with glow indicators
- Semantic HTML with proper labels and roles
Flourish Categories
- Button Effects - Ripple, scale press, focus glow
- Card Interactions - Lift on hover with shine sweep
- Loading States - Pulse loader, skeleton shimmer, progress bar
- Notifications - Slide-in toasts with spring animation
- Form Interactions - Floating labels, focus states
- Icon Morphs - Rotation transforms on hover
- Animated Counters - Eased number transitions
- Stagger Grid - IntersectionObserver-triggered reveals
Design System
- Dark developer-tool aesthetic with
#0a0a0fbase - Vibrant teal accent
#00e5a0for high contrast - JetBrains Mono for code/numbers, Space Grotesk for UI
- Consistent 8px spacing grid
- Subtle grid pattern background with gradient depth
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.