Feat: Demo page for Sune logo

This commit is contained in:
2026-02-16 20:02:06 -08:00
parent dde1bf0ddc
commit 0e31919aff

View File

@@ -1,144 +1,62 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sune </title> <title>Sune Logo Demo</title>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<style> <style>
:root { body { background-color: #f9fafb; }
--sune-primary: #ffffff; .card { background: white; border-radius: 1rem; padding: 2rem; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
--sune-bg: #000000; </style>
}
body {
background-color: var(--sune-bg);
color: var(--sune-primary);
transition: background-color 0.3s ease, color 0.3s ease;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
font-family: ui-sans-serif, system-ui, sans-serif;
}
.inverted {
--sune-primary: #000000;
--sune-bg: #ffffff;
}
@keyframes sune-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@keyframes sune-pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(0.75); opacity: 0.4; }
}
.sune-main-group {
transform-origin: center;
animation: sune-spin 16s linear infinite;
}
.is-generating .sune-main-group {
animation: sune-spin 3s linear infinite;
}
.sune-spike {
transform-origin: center;
fill: currentColor;
}
.is-generating .sune-spike {
animation: sune-pulse 1.5s ease-in-out infinite;
}
/* Staggered delays for 16 spikes */
.sune-spike:nth-child(1) { animation-delay: 0.00s; }
.sune-spike:nth-child(2) { animation-delay: 0.09s; }
.sune-spike:nth-child(3) { animation-delay: 0.18s; }
.sune-spike:nth-child(4) { animation-delay: 0.27s; }
.sune-spike:nth-child(5) { animation-delay: 0.36s; }
.sune-spike:nth-child(6) { animation-delay: 0.45s; }
.sune-spike:nth-child(7) { animation-delay: 0.54s; }
.sune-spike:nth-child(8) { animation-delay: 0.63s; }
.sune-spike:nth-child(9) { animation-delay: 0.72s; }
.sune-spike:nth-child(10) { animation-delay: 0.81s; }
.sune-spike:nth-child(11) { animation-delay: 0.90s; }
.sune-spike:nth-child(12) { animation-delay: 0.99s; }
.sune-spike:nth-child(13) { animation-delay: 1.08s; }
.sune-spike:nth-child(14) { animation-delay: 1.17s; }
.sune-spike:nth-child(15) { animation-delay: 1.26s; }
.sune-spike:nth-child(16) { animation-delay: 1.35s; }
.logo-wrapper {
width: 64px;
height: 64px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s ease;
}
.logo-wrapper:active {
transform: scale(0.85);
}
</style>
</head> </head>
<body onclick="toggleState()"> <body class="min-h-screen flex flex-col items-center justify-center p-8">
<div id="logoWrapper" class="logo-wrapper"> <div class="max-w-2xl w-full space-y-8">
<svg width="64" height="64" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <header class="text-center">
<g class="sune-main-group" id="spikeGroup"></g> <h1 class="text-3xl font-bold text-gray-900 mb-2">Sune Logo</h1>
</svg> <p class="text-gray-500">Procedural SVG Starburst Component</p>
</div> </header>
<div class="fixed bottom-6 flex gap-4"> <section class="card flex flex-col items-center gap-6">
<button onclick="event.stopPropagation(); toggleInvert()" class="text-[10px] uppercase tracking-tighter opacity-40 hover:opacity-100 transition">Invert</button> <h2 class="text-sm font-semibold uppercase tracking-widest text-gray-400">Animated Hero</h2>
</div> <div id="hero-logo"></div>
<div class="flex gap-4">
<div id="small-logo-1"></div>
<div id="small-logo-2"></div>
<div id="small-logo-3"></div>
</div>
</section>
<script> <section class="grid grid-cols-1 md:grid-cols-2 gap-6">
const spikeGroup = document.getElementById('spikeGroup'); <div class="card flex flex-col items-center gap-4">
const points = 16; <h2 class="text-sm font-semibold uppercase tracking-widest text-gray-400">Static (Export)</h2>
const outerRadius = 48; <div id="static-logo"></div>
const innerRadius = 18; // Increased for legibility at tiny scales </div>
const centerX = 50; <div class="card flex flex-col items-center gap-4">
const centerY = 50; <h2 class="text-sm font-semibold uppercase tracking-widest text-gray-400">Custom Color</h2>
<div id="colored-logo"></div>
</div>
</section>
</div>
function generateSune() { <script type="module">
let html = ''; import { suneLogoEl, suneLogoStatic } from './sune-logo.js';
for (let i = 0; i < points; i++) {
const angle = (i * 2 * Math.PI) / points;
const nextAngle = ((i + 1) * 2 * Math.PI) / points;
const midAngle = angle + (Math.PI / points);
const x1 = centerX + innerRadius * Math.cos(angle); // Hero Logo
const y1 = centerY + innerRadius * Math.sin(angle); document.getElementById('hero-logo').appendChild(suneLogoEl({ size: 128, color: '#000' }));
const xPeak = centerX + outerRadius * Math.cos(midAngle);
const yPeak = centerY + outerRadius * Math.sin(midAngle);
const x2 = centerX + innerRadius * Math.cos(nextAngle);
const y2 = centerY + innerRadius * Math.sin(nextAngle);
html += `<path class="sune-spike" d="M ${centerX} ${centerY} L ${x1} ${y1} L ${xPeak} ${yPeak} L ${x2} ${y2} Z" />`; // Small Variations
} document.getElementById('small-logo-1').appendChild(suneLogoEl({ size: 32, color: '#4b5563' }));
spikeGroup.innerHTML = html; document.getElementById('small-logo-2').appendChild(suneLogoEl({ size: 32, color: '#9ca3af' }));
} document.getElementById('small-logo-3').appendChild(suneLogoEl({ size: 32, color: '#d1d5db' }));
function toggleInvert() { // Static Version
document.body.classList.toggle('inverted'); const staticSvg = suneLogoStatic({ size: 64, color: '#000' });
} document.getElementById('static-logo').innerHTML = staticSvg;
function toggleState() { // Colored Version
const wrapper = document.getElementById('logoWrapper'); document.getElementById('colored-logo').appendChild(suneLogoEl({ size: 64, color: '#f59e0b' }));
const isGen = wrapper.classList.toggle('is-generating'); </script>
if ('vibrate' in navigator) navigator.vibrate(10);
}
generateSune();
</script>
</body> </body>
</html> </html>