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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Procedural Universe Explorer</title>
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<link
|
| 10 |
+
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;600;700&family=JetBrains+Mono:wght@400;700&display=swap"
|
| 11 |
+
rel="stylesheet">
|
| 12 |
+
<style>
|
| 13 |
+
:root {
|
| 14 |
+
--neon-cyan: #00f3ff;
|
| 15 |
+
--neon-pink: #ff00ff;
|
| 16 |
+
--deep-space: #050510;
|
| 17 |
+
--glass-bg: rgba(255, 255, 255, 0.03);
|
| 18 |
+
--glass-border: rgba(255, 255, 255, 0.1);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
body {
|
| 22 |
+
background-color: var(--deep-space);
|
| 23 |
+
color: white;
|
| 24 |
+
font-family: 'Space Grotesk', sans-serif;
|
| 25 |
+
overflow-x: hidden;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.mono {
|
| 29 |
+
font-family: 'JetBrains Mono', monospace;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/* Custom Scrollbar */
|
| 33 |
+
::-webkit-scrollbar {
|
| 34 |
+
width: 8px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
::-webkit-scrollbar-track {
|
| 38 |
+
background: #0a0a1a;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
::-webkit-scrollbar-thumb {
|
| 42 |
+
background: #333;
|
| 43 |
+
border-radius: 4px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
::-webkit-scrollbar-thumb:hover {
|
| 47 |
+
background: var(--neon-cyan);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* Glassmorphism Utilities */
|
| 51 |
+
.glass-panel {
|
| 52 |
+
background: var(--glass-bg);
|
| 53 |
+
backdrop-filter: blur(12px);
|
| 54 |
+
-webkit-backdrop-filter: blur(12px);
|
| 55 |
+
border: 1px solid var(--glass-border);
|
| 56 |
+
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.glass-card {
|
| 60 |
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
|
| 61 |
+
backdrop-filter: blur(10px);
|
| 62 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 63 |
+
transition: all 0.3s ease;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.glass-card:hover {
|
| 67 |
+
transform: translateY(-5px);
|
| 68 |
+
border-color: var(--neon-cyan);
|
| 69 |
+
box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/* Animations */
|
| 73 |
+
@keyframes float {
|
| 74 |
+
0% {
|
| 75 |
+
transform: translateY(0px);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
50% {
|
| 79 |
+
transform: translateY(-10px);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
100% {
|
| 83 |
+
transform: translateY(0px);
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.animate-float {
|
| 88 |
+
animation: float 6s ease-in-out infinite;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
@keyframes pulse-glow {
|
| 92 |
+
|
| 93 |
+
0%,
|
| 94 |
+
100% {
|
| 95 |
+
opacity: 0.5;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
50% {
|
| 99 |
+
opacity: 1;
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.glow-text {
|
| 104 |
+
text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/* Range Slider Styling */
|
| 108 |
+
input[type=range] {
|
| 109 |
+
-webkit-appearance: none;
|
| 110 |
+
width: 100%;
|
| 111 |
+
background: transparent;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
input[type=range]::-webkit-slider-thumb {
|
| 115 |
+
-webkit-appearance: none;
|
| 116 |
+
height: 16px;
|
| 117 |
+
width: 16px;
|
| 118 |
+
border-radius: 50%;
|
| 119 |
+
background: var(--neon-cyan);
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
margin-top: -6px;
|
| 122 |
+
box-shadow: 0 0 10px var(--neon-cyan);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
input[type=range]::-webkit-slider-runnable-track {
|
| 126 |
+
width: 100%;
|
| 127 |
+
height: 4px;
|
| 128 |
+
cursor: pointer;
|
| 129 |
+
background: rgba(255, 255, 255, 0.2);
|
| 130 |
+
border-radius: 2px;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/* Grid Background */
|
| 134 |
+
.bg-grid {
|
| 135 |
+
background-size: 40px 40px;
|
| 136 |
+
background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
|
| 137 |
+
linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
|
| 138 |
+
mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.crt-overlay {
|
| 142 |
+
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
|
| 143 |
+
background-size: 100% 2px, 3px 100%;
|
| 144 |
+
pointer-events: none;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
/* Glitch Effect Class */
|
| 148 |
+
.glitch-hover:hover {
|
| 149 |
+
animation: glitch 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
|
| 150 |
+
color: var(--neon-pink);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
@keyframes glitch {
|
| 154 |
+
0% {
|
| 155 |
+
transform: translate(0)
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
20% {
|
| 159 |
+
transform: translate(-2px, 2px)
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
40% {
|
| 163 |
+
transform: translate(-2px, -2px)
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
60% {
|
| 167 |
+
transform: translate(2px, 2px)
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
80% {
|
| 171 |
+
transform: translate(2px, -2px)
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
100% {
|
| 175 |
+
transform: translate(0)
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
</style>
|
| 179 |
+
</head>
|
| 180 |
+
|
| 181 |
+
<body class="min-h-screen relative selection:bg-cyan-500 selection:text-black">
|
| 182 |
+
|
| 183 |
+
<!-- Background Canvas -->
|
| 184 |
+
<canvas id="starfield" class="fixed top-0 left-0 w-full h-full z-0"></canvas>
|
| 185 |
+
<div class="fixed top-0 left-0 w-full h-full bg-grid z-0 pointer-events-none"></div>
|
| 186 |
+
<div class="fixed top-0 left-0 w-full h-full crt-overlay z-50 pointer-events-none opacity-30"></div>
|
| 187 |
+
|
| 188 |
+
<!-- Main Content Wrapper -->
|
| 189 |
+
<div class="relative z-10 flex flex-col min-h-screen">
|
| 190 |
+
|
| 191 |
+
<!-- Header -->
|
| 192 |
+
<header class="w-full p-6 flex justify-between items-center glass-panel sticky top-0 z-50 border-b border-white/10">
|
| 193 |
+
<div class="flex items-center gap-3 group cursor-pointer" onclick="window.location.reload()">
|
| 194 |
+
<div
|
| 195 |
+
class="w-8 h-8 rounded-full bg-gradient-to-tr from-cyan-500 to-purple-600 animate-pulse group-hover:rotate-180 transition-transform duration-700">
|
| 196 |
+
</div>
|
| 197 |
+
<h1 class="text-2xl font-bold tracking-tighter uppercase mono">NEXUS<span class="text-cyan-400">GEN</span></h1>
|
| 198 |
+
</div>
|
| 199 |
+
<nav class="hidden md:flex gap-8 text-sm font-medium text-gray-400">
|
| 200 |
+
<a href="#" class="hover:text-cyan-400 transition-colors">Explore</a>
|
| 201 |
+
<a href="#generator" class="hover:text-cyan-400 transition-colors">Create</a>
|
| 202 |
+
<a href="#about" class="hover:text-cyan-400 transition-colors">About</a>
|
| 203 |
+
</nav>
|
| 204 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank"
|
| 205 |
+
class="text-xs mono text-gray-500 hover:text-white transition-colors border border-white/10 px-3 py-1 rounded-full">
|
| 206 |
+
Built with anycoder
|
| 207 |
+
</a>
|
| 208 |
+
</header>
|
| 209 |
+
|
| 210 |
+
<!-- Hero Section -->
|
| 211 |
+
<main
|
| 212 |
+
class="flex-grow container mx-auto px-4 py-12 flex flex-col items-center justify-center text-center min-h-[80vh]">
|
| 213 |
+
|
| 214 |
+
<div
|
| 215 |
+
class="inline-block mb-4 px-4 py-1 rounded-full border border-cyan-500/30 bg-cyan-500/10 text-cyan-300 text-xs mono tracking-widest animate-float">
|
| 216 |
+
SYSTEM ONLINE // V.2.0.4
|
| 217 |
+
</div>
|
| 218 |
+
|
| 219 |
+
<h2 class="text-5xl md:text-7xl font-bold mb-6 leading-tight">
|
| 220 |
+
Procedural <br>
|
| 221 |
+
<span class="text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 via-purple-400 to-pink-400 glow-text">Universe Engine</span>
|
| 222 |
+
</h2>
|
| 223 |
+
|
| 224 |
+
<p class="text-gray-400 max-w-2xl text-lg mb-10 leading-relaxed">
|
| 225 |
+
Generate infinite worlds, terrains, and abstract art using mathematical algorithms.
|
| 226 |
+
No assets loaded. Everything is calculated in real-time.
|
| 227 |
+
</p>
|
| 228 |
+
|
| 229 |
+
<div class="flex flex-wrap gap-4 justify-center">
|
| 230 |
+
<button onclick="scrollToSection('generator')" class="group relative px-8 py-4 bg-cyan-500 hover:bg-cyan-400 text-black font-bold rounded-lg overflow-hidden transition-all hover:scale-105 hover:shadow-[0_0_30px_rgba(6,182,212,0.5)]">
|
| 231 |
+
<span class="relative z-10 flex items-center gap-2">
|
| 232 |
+
Initialize Generator
|
| 233 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 group-hover:translate-x-1 transition-transform" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
|
| 234 |
+
</span>
|
| 235 |
+
<div class="absolute inset-0 bg-white/20 translate-y-full group-hover:translate-y-0 transition-transform duration-300"></div>
|
| 236 |
+
</button>
|
| 237 |
+
|
| 238 |
+
<button onclick="randomizeSeed()" class="px-8 py-4 glass-panel hover:bg-white/10 text-white font-semibold rounded-lg transition-all border border-white/20 hover:border-white/40">
|
| 239 |
+
Randomize Seed
|
| 240 |
+
</button>
|
| 241 |
+
</div>
|
| 242 |
+
|
| 243 |
+
<!-- Live Stats -->
|
| 244 |
+
<div class="mt-16 grid grid-cols-2 md:grid-cols-4 gap-8 w-full max-w-4xl border-t border-white/10 pt-8">
|
| 245 |
+
<div class="text-center">
|
| 246 |
+
<div class="text-3xl font-bold mono text-cyan-400" id="stat-fps">60</div>
|
| 247 |
+
<div class="text-xs text-gray-500 uppercase tracking-wider mt-1">FPS</div>
|
| 248 |
+
</div>
|
| 249 |
+
<div class="text-center">
|
| 250 |
+
<div class="text-3xl font-bold mono text-purple-400" id="stat-objects">0</div>
|
| 251 |
+
<div class="text-xs text-gray-500 uppercase tracking-wider mt-1">Entities</div>
|
| 252 |
+
</div>
|
| 253 |
+
<div class="text-center">
|
| 254 |
+
<div class="text-3xl font-bold mono text-pink-400" id="stat-seed">8492</div>
|
| 255 |
+
<div class="text-xs text-gray-500 uppercase tracking-wider mt-1">Current Seed</div>
|
| 256 |
+
</div>
|
| 257 |
+
<div class="text-center">
|
| 258 |
+
<div class="text-3xl font-bold mono text-green-400">∞</div>
|
| 259 |
+
<div class="text-xs text-gray-500 uppercase tracking-wider mt-1">Possibilities</div>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
</main>
|
| 263 |
+
|
| 264 |
+
<!-- Generator Dashboard -->
|
| 265 |
+
<section id="generator" class="py-20 bg-black/40 backdrop-blur-sm border-t border-white/5">
|
| 266 |
+
<div class="container mx-auto px-4">
|
| 267 |
+
<div class="flex flex-col lg:flex-row gap-8 h-[800px]">
|
| 268 |
+
|
| 269 |
+
<!-- Controls Sidebar -->
|
| 270 |
+
<div class="w-full lg:w-1/4 glass-panel rounded-xl p-6 flex flex-col gap-6 overflow-y-auto">
|
| 271 |
+
<div>
|
| 272 |
+
<h3 class="text-xl font-bold mb-1 flex items-center gap-2">
|
| 273 |
+
<span class="w-2 h-2 bg-cyan-400 rounded-full animate-pulse"></span>
|
| 274 |
+
Parameters
|
| 275 |
+
</h3>
|
| 276 |
+
<p class="text-xs text-gray-500 mono">ADJUST SIMULATION VARIABLES</p>
|
| 277 |
+
</div>
|
| 278 |
+
|
| 279 |
+
<!-- Control Group: Terrain -->
|
| 280 |
+
<div class="space-y-4">
|
| 281 |
+
<label class="text-sm font-semibold text-gray-300 uppercase tracking-wider">Terrain Complexity</label>
|
| 282 |
+
<input type="range" id="complexity" min="1" max="100" value="50" oninput="updateParams()">
|
| 283 |
+
<div class="flex justify-between text-xs text-gray-500 mono">
|
| 284 |
+
<span>Flat</span>
|
| 285 |
+
<span>Chaotic</span>
|
| 286 |
+
</div>
|
| 287 |
+
</div>
|
| 288 |
+
|
| 289 |
+
<!-- Control Group: Color -->
|
| 290 |
+
<div class="space-y-4">
|
| 291 |
+
<label class="text-sm font-semibold text-gray-300 uppercase tracking-wider">Biome Shift</label>
|
| 292 |
+
<input type="range" id="biome" min="0" max="360" value="180" oninput="updateParams()">
|
| 293 |
+
<div class="h-2 w-full rounded-full bg-gradient-to-r from-red-500 via-green-500 to-blue-500"></div>
|
| 294 |
+
</div>
|
| 295 |
+
|
| 296 |
+
<!-- Control Group: Speed -->
|
| 297 |
+
<div class="space-y-4">
|
| 298 |
+
<label class="text-sm font-semibold text-gray-300 uppercase tracking-wider">Time Dilation</label>
|
| 299 |
+
<input type="range" id="speed" min="0" max="50" value="10" oninput="updateParams()">
|
| 300 |
+
</div>
|
| 301 |
+
|
| 302 |
+
<hr class="border-white/10">
|
| 303 |
+
|
| 304 |
+
<!-- Toggles -->
|
| 305 |
+
<div class="space-y-3">
|
| 306 |
+
<label class="flex items-center justify-between cursor-pointer group">
|
| 307 |
+
<span class="text-sm text-gray-300 group-hover:text-white">Wireframe Mode</span>
|
| 308 |
+
<input type="checkbox" id="wireframe" class="accent-cyan-500 w-4 h-4" onchange="updateParams()">
|
| 309 |
+
</label>
|
| 310 |
+
<label class="flex items-center justify-between cursor-pointer group">
|
| 311 |
+
<span class="text-sm text-gray-300 group-hover:text-white">Show Nodes</span>
|
| 312 |
+
<input type="checkbox" id="nodes" checked class="accent-cyan-500 w-4 h-4" onchange="updateParams()">
|
| 313 |
+
</label>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
<div class="mt-auto">
|
| 317 |
+
<button onclick="downloadCanvas()" class="w-full py-3 border border-cyan-500/50 text-cyan-400 hover:bg-cyan-500/10 rounded-lg transition-colors flex items-center justify-center gap-2 text-sm font-bold uppercase">
|
| 318 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /></svg>
|
| 319 |
+
Export Render
|
| 320 |
+
</button>
|
| 321 |
+
</div>
|
| 322 |
+
</div>
|
| 323 |
+
|
| 324 |
+
<!-- Visualization Area -->
|
| 325 |
+
<div class="w-full lg:w-3/4 glass-panel rounded-xl p-1 relative overflow-hidden group">
|
| 326 |
+
<div class="absolute top-4 left-4 z-10 bg-black/50 backdrop-blur px-3 py-1 rounded border border-white/10">
|
| 327 |
+
<span class="text-xs mono text-cyan-400">VIEWPORT: ACTIVE</span>
|
| 328 |
+
</div>
|
| 329 |
+
|
| 330 |
+
<!-- The Main Procedural Canvas -->
|
| 331 |
+
<canvas id="procCanvas" class="w-full h-full rounded-lg bg-black cursor-crosshair"></canvas>
|
| 332 |
+
|
| 333 |
+
<!-- Overlay UI -->
|
| 334 |
+
<div class="absolute bottom-4 right-4 flex gap-2">
|
| 335 |
+
<div class="w-3 h-3 rounded-full bg-red-500 animate-pulse"></div>
|
| 336 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500 animate-pulse delay-75"></div>
|
| 337 |
+
<div class="w-3 h-3 rounded-full bg-green-500 animate-pulse delay-150"></div>
|
| 338 |
+
</div>
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
+
</section>
|
| 343 |
+
|
| 344 |
+
<!-- Feature Grid -->
|
| 345 |
+
<section class="py-20 container mx-auto px-4">
|
| 346 |
+
<h3 class="text-3xl font-bold mb-12 text-center">Procedural Capabilities</h3>
|
| 347 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 348 |
+
|
| 349 |
+
<!-- Card 1 -->
|
| 350 |
+
<div class="glass-card p-8 rounded-2xl relative overflow-hidden group">
|
| 351 |
+
<div
|
| 352 |
+
class="absolute -right-10 -top-10 w-32 h-32 bg-purple-500/20 rounded-full blur-3xl group-hover:bg-purple-500/40 transition-all">
|
| 353 |
+
</div>
|
| 354 |
+
<div class="w-12 h-12 bg-white/5 rounded-lg flex items-center justify-center mb-6 border border-white/10">
|
| 355 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-purple-400" fill="none" viewBox="0 0 24 24"
|
| 356 |
+
stroke="currentColor">
|
| 357 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
| 358 |
+
d="M19.428 15.428a2 2 0 00-1.022-.547l-2.384-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" />
|
| 359 |
+
</svg>
|
| 360 |
+
</div>
|
| 361 |
+
<h4 class="text-xl font-bold mb-2">Fractal Noise</h4>
|
| 362 |
+
<p class="text-gray-400 text-sm leading-relaxed">
|
| 363 |
+
Utilizes Perlin and Simplex noise algorithms to generate organic-looking textures and terrain that never
|
| 364 |
+
repeat.
|
| 365 |
+
</p>
|
| 366 |
+
</div>
|
| 367 |
+
|
| 368 |
+
<!-- Card 2 -->
|
| 369 |
+
<div class="glass-card p-8 rounded-2xl relative overflow-hidden group">
|
| 370 |
+
<div
|
| 371 |
+
class="absolute -right-10 -top-10 w-32 h-32 bg-cyan-500/20 rounded-full blur-3xl group-hover:bg-cyan-500/40 transition-all">
|
| 372 |
+
</div>
|
| 373 |
+
<div class="w-12 h-12 bg-white/5 rounded-lg flex items-center justify-center mb-6 border border-white/10">
|
| 374 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-cyan-400" fill="none" viewBox="0 0 24 24"
|
| 375 |
+
stroke="currentColor">
|
| 376 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
| 377 |
+
d="M14 10l-2 1m0 0l-2-1m2 1v2.5M20 7l-2 1m2-1l-2-1m2 1v2.5M14 4l-2-1-2 1M4 7l2-1M4 7l2 1M4 7v2.5M12 21l-2-1m2 1l2-1m-2 1v-2.5M6 18l-2-1v-2.5M18 18l2-1v-2.5" />
|
| 378 |
+
</svg>
|
| 379 |
+
</div>
|
| 380 |
+
<h4 class="text-xl font-bold mb-2">Vector Fields</h4>
|
| 381 |
+
<p class="text-gray-400 text-sm leading-relaxed">
|
| 382 |
+
Simulates fluid dynamics and particle flows using curl noise to create mesmerizing motion patterns.
|
| 383 |
+
</p>
|
| 384 |
+
</div>
|
| 385 |
+
|
| 386 |
+
<!-- Card 3 -->
|
| 387 |
+
<div class="glass-card p-8 rounded-2xl relative overflow-hidden group">
|
| 388 |
+
<div
|
| 389 |
+
class="absolute -right-10 -top-10 w-32 h-32 bg-pink-500/20 rounded-full blur-3xl group-hover:bg-pink-500/40 transition-all">
|
| 390 |
+
</div>
|
| 391 |
+
<div class="w-12 h-12 bg-white/5 rounded-lg flex items-center justify-center mb-6 border border-white/10">
|
| 392 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-pink-400" fill="none" viewBox="0 0 24 24"
|
| 393 |
+
stroke="currentColor">
|
| 394 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
| 395 |
+
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
| 396 |
+
</svg>
|
| 397 |
+
</div>
|
| 398 |
+
<h4 class="text-xl font-bold mb-2">L-Systems</h4>
|
| 399 |
+
<p class="text-gray-400 text-sm leading-relaxed">
|
| 400 |
+
Recursive string rewriting systems used to model the growth processes of plant development and geometric
|
| 401 |
+
structures.
|
| 402 |
+
</p>
|
| 403 |
+
</div>
|
| 404 |
+
|
| 405 |
+
</div>
|
| 406 |
+
</section>
|
| 407 |
+
|
| 408 |
+
<!-- Footer -->
|
| 409 |
+
<footer class="border-t border-white/10 bg-black/80 py-12">
|
| 410 |
+
<div class="container mx-auto px-4 flex flex-col md:flex-row justify-between items-center gap-6">
|
| 411 |
+
<div class="text-center md:text-left">
|
| 412 |
+
<h2 class="text-2xl font-bold tracking-tighter uppercase mono">NEXUS<span class="text-cyan-400">GEN</span>
|
| 413 |
+
</h2>
|
| 414 |
+
<p class="text-gray-500 text-sm mt-2">Infinite possibilities in a finite space.</p>
|
| 415 |
+
</div>
|
| 416 |
+
<div class="flex gap-6">
|
| 417 |
+
<a href="#" class="text-gray-400 hover:text-white transition-colors">Github</a>
|
| 418 |
+
<a href="#" class="text-gray-400 hover:text-white transition-colors">Twitter</a>
|
| 419 |
+
<a href="#" class="text-gray-400 hover:text-white transition-colors">Discord</a>
|
| 420 |
+
</div>
|
| 421 |
+
<div class="text-gray-600 text-xs mono">
|
| 422 |
+
© 2023 PROCEDURAL SYSTEMS
|
| 423 |
+
</div>
|
| 424 |
+
</div>
|
| 425 |
+
</footer>
|
| 426 |
+
|
| 427 |
+
</div>
|
| 428 |
+
|
| 429 |
+
<script>
|
| 430 |
+
/**
|
| 431 |
+
* UTILITIES
|
| 432 |
+
*/
|
| 433 |
+
function scrollToSection(id) {
|
| 434 |
+
document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
// Seeded Random Number Generator (Mulberry32)
|
| 438 |
+
function mulberry32(a) {
|
| 439 |
+
return function() {
|
| 440 |
+
var t = a += 0x6D2B79F5;
|
| 441 |
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
| 442 |
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
| 443 |
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
| 444 |
+
}
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
let seed = Math.floor(Math.random() * 10000);
|
| 448 |
+
let rand = mulberry32(seed);
|
| 449 |
+
|
| 450 |
+
function randomizeSeed() {
|
| 451 |
+
seed = Math.floor(Math.random() * 100000);
|
| 452 |
+
rand = mulberry32(seed);
|
| 453 |
+
document.getElementById('stat-seed').innerText = seed;
|
| 454 |
+
initStars(); // Re-init stars
|
| 455 |
+
time = 0; // Reset procedural anim
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
/**
|
| 459 |
+
* BACKGROUND STARFIELD
|
| 460 |
+
*/
|
| 461 |
+
const starCanvas = document.getElementById('starfield');
|
| 462 |
+
const starCtx = starCanvas.getContext('2d');
|
| 463 |
+
let stars = [];
|
| 464 |
+
const numStars = 200;
|
| 465 |
+
|
| 466 |
+
function resizeStarCanvas() {
|
| 467 |
+
starCanvas.width = window.innerWidth;
|
| 468 |
+
starCanvas.height = window.innerHeight;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
class Star {
|
| 472 |
+
constructor() {
|
| 473 |
+
this.reset();
|
| 474 |
+
}
|
| 475 |
+
reset() {
|
| 476 |
+
this.x = rand() * starCanvas.width;
|
| 477 |
+
this.y = rand() * starCanvas.height;
|
| 478 |
+
this.z = rand() * 2 + 0.5; // Depth/Speed
|
| 479 |
+
this.size = rand() * 1.5;
|
| 480 |
+
this.opacity = rand();
|
| 481 |
+
this.fadeDir = 0.01;
|
| 482 |
+
}
|
| 483 |
+
update() {
|
| 484 |
+
this.y -= this.z * 0.2; // Move up slowly
|
| 485 |
+
this.opacity += this.fadeDir;
|
| 486 |
+
|
| 487 |
+
if (this.opacity > 1 || this.opacity < 0.2) this.fadeDir *= -1;
|
| 488 |
+
|
| 489 |
+
if (this.y < 0) {
|
| 490 |
+
this.y = starCanvas.height;
|
| 491 |
+
this.x = rand() * starCanvas.width;
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
draw() {
|
| 495 |
+
starCtx.fillStyle = `rgba(255, 255, 255, ${this.opacity})`;
|
| 496 |
+
starCtx.beginPath();
|
| 497 |
+
starCtx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
|
| 498 |
+
starCtx.fill();
|
| 499 |
+
}
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
function initStars() {
|
| 503 |
+
stars = [];
|
| 504 |
+
for(let i=0; i<numStars; i++) stars.push(new Star());
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
function animateStars() {
|
| 508 |
+
starCtx.clearRect(0, 0, starCanvas.width, starCanvas.height);
|
| 509 |
+
stars.forEach(star => {
|
| 510 |
+
star.update();
|
| 511 |
+
star.draw();
|
| 512 |
+
});
|
| 513 |
+
requestAnimationFrame(animateStars);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
/**
|
| 517 |
+
* MAIN PROCEDURAL VISUALIZATION (The "Cool" Part)
|
| 518 |
+
* Simulating a 3D Terrain/Topography using 2D Canvas
|
| 519 |
+
*/
|
| 520 |
+
const canvas = document.getElementById('procCanvas');
|
| 521 |
+
const ctx = canvas.getContext('2d');
|
| 522 |
+
let width, height;
|
| 523 |
+
let time = 0;
|
| 524 |
+
|
| 525 |
+
// Parameters controlled by UI
|
| 526 |
+
let params = {
|
| 527 |
+
complexity: 50,
|
| 528 |
+
biome: 180,
|
| 529 |
+
speed: 10,
|
| 530 |
+
wireframe: false,
|
| 531 |
+
showNodes: true
|
| 532 |
+
};
|
| 533 |
+
|
| 534 |
+
function resizeProcCanvas() {
|
| 535 |
+
const rect = canvas.parentElement.getBoundingClientRect();
|
| 536 |
+
canvas.width = rect.width;
|
| 537 |
+
canvas.height = rect.height;
|
| 538 |
+
width = canvas.width;
|
| 539 |
+
height = canvas.height;
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
function updateParams() {
|
| 543 |
+
params.complexity = parseInt(document.getElementById('complexity').value);
|
| 544 |
+
params.biome = parseInt(document.getElementById('biome').value);
|
| 545 |
+
params.speed = parseInt(document.getElementById('speed').value);
|
| 546 |
+
params.wireframe = document.getElementById('wireframe').checked;
|
| 547 |
+
params.showNodes = document.getElementById('nodes').checked;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
// Pseudo-3D Projection Logic
|
| 551 |
+
function drawTerrain() {
|
| 552 |
+
// Clear with fade effect for trails
|
| 553 |
+
ctx.fillStyle = 'rgba(5, 5, 16, 0.3)';
|
| 554 |
+
ctx.fillRect(0, 0, width, height);
|
| 555 |
+
|
| 556 |
+
const horizon = height * 0.6;
|
| 557 |
+
const fov = 300;
|
| 558 |
+
const gridSize = 40; // Number of rows
|
| 559 |
+
|
| 560 |
+
// We draw from back to front
|
| 561 |
+
for (let z = gridSize; z > 0; z--) {
|
| 562 |
+
// Perspective scale
|
| 563 |
+
const scale = fov / (fov + z * 10);
|
| 564 |
+
const yBase = horizon + (z * 10) * scale; // Project Y
|
| 565 |
+
|
| 566 |
+
// Color based on depth and biome
|
| 567 |
+
const hue = (params.biome + z * 2) % 360;
|
| 568 |
+
const lightness = 20 + (z / gridSize) * 40;
|
| 569 |
+
|
| 570 |
+
ctx.beginPath();
|
| 571 |
+
|
| 572 |
+
// Draw a horizontal strip
|
| 573 |
+
const stripWidth = width / scale; // How wide the world is at this depth
|
| 574 |
+
|
| 575 |
+
for (let x = -stripWidth/2; x <= stripWidth/2; x += 20) {
|
| 576 |
+
// Calculate Height (Y) based on Sine Waves (Procedural Terrain)
|
| 577 |
+
// Using multiple sine waves for complexity
|
| 578 |
+
const wave1 = Math.sin(x * 0.01 + time * 0.05 + z * 0.1) * (params.complexity * scale);
|
| 579 |
+
const wave2 = Math.cos(x * 0.02 - time * 0.02) * (params.complexity * 0.5 * scale);
|
| 580 |
+
const yOffset = wave1 + wave2;
|
| 581 |
+
|
| 582 |
+
const screenX = width/2 + x * scale;
|
| 583 |
+
const screenY = yBase - yOffset;
|
| 584 |
+
|
| 585 |
+
if (x === -stripWidth/2) {
|
| 586 |
+
ctx.moveTo(screenX, screenY);
|
| 587 |
+
} else {
|
| 588 |
+
ctx.lineTo(screenX, screenY);
|
| 589 |
+
}
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
// Close the shape to fill it
|
| 593 |
+
ctx.lineTo(width/2 + stripWidth/2 * scale, yBase + 100 * scale);
|
| 594 |
+
ctx.lineTo(width/2 - stripWidth/2 * scale, yBase + 100 * scale);
|
| 595 |
+
ctx.closePath();
|
| 596 |
+
|
| 597 |
+
if (params.wireframe) {
|
| 598 |
+
ctx.strokeStyle = `hsla(${hue}, 80%, 60%, 0.8)`;
|
| 599 |
+
ctx.lineWidth = 1;
|
| 600 |
+
ctx.stroke();
|
| 601 |
+
} else {
|
| 602 |
+
// Gradient fill for depth
|
| 603 |
+
const gradient = ctx.createLinearGradient(0, yBase - params.complexity * scale, 0, yBase + 50 * scale);
|
| 604 |
+
gradient.addColorStop(0, `hsla(${hue}, 70%, ${lightness + 20}%, 0.9)`);
|
| 605 |
+
gradient.addColorStop(0.5, `hsla(${hue}, 70%, ${lightness}%, 0.6)`);
|
| 606 |
+
gradient.addColorStop(1, `hsla(${hue}, 70%, ${lightness - 10}%, 0.2)`);
|
| 607 |
+
ctx.fillStyle = gradient;
|
| 608 |
+
ctx.fill();
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
// Draw nodes if enabled
|
| 612 |
+
if (params.showNodes && z % 5 === 0) {
|
| 613 |
+
for (let x = -stripWidth/2; x <= stripWidth/2; x += 60) {
|
| 614 |
+
const wave1 = Math.sin(x * 0.01 + time * 0.05 + z * 0.1) * (params.complexity * scale);
|
| 615 |
+
const wave2 = Math.cos(x * 0.02 - time * 0.02) * (params.complexity * 0.5 * scale);
|
| 616 |
+
const yOffset = wave1 + wave2;
|
| 617 |
+
const screenX = width/2 + x * scale;
|
| 618 |
+
const screenY = yBase - yOffset;
|
| 619 |
+
|
| 620 |
+
ctx.fillStyle = `hsla(${(hue + 180) % 360}, 100%, 70%, 0.8)`;
|
| 621 |
+
ctx.beginPath();
|
| 622 |
+
ctx.arc(screenX, screenY, 2 * scale, 0, Math.PI * 2);
|
| 623 |
+
ctx.fill();
|
| 624 |
+
}
|
| 625 |
+
}
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
// Update stats
|
| 629 |
+
document.getElementById('stat-objects').innerText = gridSize * 20;
|
| 630 |
+
|
| 631 |
+
time += params.speed * 0.01;
|
| 632 |
+
requestAnimationFrame(drawTerrain);
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
// FPS Counter
|
| 636 |
+
let lastTime = performance.now();
|
| 637 |
+
let frameCount = 0;
|
| 638 |
+
function updateFPS() {
|
| 639 |
+
const now = performance.now();
|
| 640 |
+
frameCount++;
|
| 641 |
+
if (now - lastTime >= 1000) {
|
| 642 |
+
document.getElementById('stat-fps').innerText = frameCount;
|
| 643 |
+
frameCount = 0;
|
| 644 |
+
lastTime = now;
|
| 645 |
+
}
|
| 646 |
+
requestAnimationFrame(updateFPS);
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
// Download canvas image
|
| 650 |
+
function downloadCanvas() {
|
| 651 |
+
const link = document.createElement('a');
|
| 652 |
+
link.download = `nexusgen-terrain-${seed}-${Date.now()}.png`;
|
| 653 |
+
link.href = canvas.toDataURL();
|
| 654 |
+
link.click();
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
// Initialization
|
| 658 |
+
window.addEventListener('resize', () => {
|
| 659 |
+
resizeStarCanvas();
|
| 660 |
+
resizeProcCanvas();
|
| 661 |
+
});
|
| 662 |
+
|
| 663 |
+
window.addEventListener('DOMContentLoaded', () => {
|
| 664 |
+
resizeStarCanvas();
|
| 665 |
+
resizeProcCanvas();
|
| 666 |
+
initStars();
|
| 667 |
+
animateStars();
|
| 668 |
+
drawTerrain();
|
| 669 |
+
updateFPS();
|
| 670 |
+
|
| 671 |
+
// Set initial seed display
|
| 672 |
+
document.getElementById('stat-seed').innerText = seed;
|
| 673 |
+
});
|
| 674 |
+
</script>
|
| 675 |
+
</body>
|
| 676 |
+
|
| 677 |
+
</html>
|