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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Crimson Canvas Creations</title>
|
| 7 |
+
<script src="https://unpkg.com/lucide@latest"></script>
|
| 8 |
+
|
| 9 |
+
<!-- Google Fonts -->
|
| 10 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 11 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Playfair+Display:wght@700&display=swap" rel="stylesheet">
|
| 13 |
+
|
| 14 |
+
<style>
|
| 15 |
+
:root {
|
| 16 |
+
--primary-color: #8b0000; /* Crimson */
|
| 17 |
+
--primary-hover: #a52a2a;
|
| 18 |
+
--bg-dark: #0f0f0f;
|
| 19 |
+
--bg-card: #1a1a1a;
|
| 20 |
+
--text-main: #f0f0f0;
|
| 21 |
+
--text-muted: #a0a0a0;
|
| 22 |
+
--accent-glow: rgba(139, 0, 0, 0.4);
|
| 23 |
+
--border-color: #333;
|
| 24 |
+
--font-heading: 'Playfair Display', serif;
|
| 25 |
+
--font-body: 'Outfit', sans-serif;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
* {
|
| 29 |
+
box-sizing: border-box;
|
| 30 |
+
margin: 0;
|
| 31 |
+
padding: 0;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
body {
|
| 35 |
+
background-color: var(--bg-dark);
|
| 36 |
+
color: var(--text-main);
|
| 37 |
+
font-family: var(--font-body);
|
| 38 |
+
line-height: 1.6;
|
| 39 |
+
min-height: 100vh;
|
| 40 |
+
display: flex;
|
| 41 |
+
flex-direction: column;
|
| 42 |
+
overflow-x: hidden;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/* --- Header & Footer --- */
|
| 46 |
+
header {
|
| 47 |
+
padding: 20px;
|
| 48 |
+
border-bottom: 1px solid var(--border-color);
|
| 49 |
+
background-color: var(--bg-dark);
|
| 50 |
+
position: sticky;
|
| 51 |
+
top: 0;
|
| 52 |
+
z-index: 100;
|
| 53 |
+
backdrop-filter: blur(10px);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.nav-container {
|
| 57 |
+
max-width: 1200px;
|
| 58 |
+
margin: 0 auto;
|
| 59 |
+
display: flex;
|
| 60 |
+
justify-content: space-between;
|
| 61 |
+
align-items: center;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.brand {
|
| 65 |
+
font-family: var(--font-heading);
|
| 66 |
+
font-size: 1.8rem;
|
| 67 |
+
color: var(--text-main);
|
| 68 |
+
text-decoration: none;
|
| 69 |
+
display: flex;
|
| 70 |
+
align-items: center;
|
| 71 |
+
gap: 10px;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.brand span {
|
| 75 |
+
color: var(--primary-color);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.footer-link {
|
| 79 |
+
text-decoration: none;
|
| 80 |
+
color: var(--text-muted);
|
| 81 |
+
font-size: 0.85rem;
|
| 82 |
+
transition: color 0.3s;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.footer-link:hover {
|
| 86 |
+
color: var(--primary-color);
|
| 87 |
+
text-decoration: underline;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/* --- Main Layout --- */
|
| 91 |
+
main {
|
| 92 |
+
flex: 1;
|
| 93 |
+
max-width: 1200px;
|
| 94 |
+
margin: 0 auto;
|
| 95 |
+
padding: 40px 20px;
|
| 96 |
+
width: 100%;
|
| 97 |
+
display: grid;
|
| 98 |
+
grid-template-columns: 350px 1fr;
|
| 99 |
+
gap: 40px;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/* --- Controls Sidebar --- */
|
| 103 |
+
.controls-panel {
|
| 104 |
+
background: var(--bg-card);
|
| 105 |
+
padding: 30px;
|
| 106 |
+
border-radius: 16px;
|
| 107 |
+
border: 1px solid var(--border-color);
|
| 108 |
+
height: fit-content;
|
| 109 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
h2 {
|
| 113 |
+
font-family: var(--font-heading);
|
| 114 |
+
font-size: 2rem;
|
| 115 |
+
margin-bottom: 25px;
|
| 116 |
+
color: var(--text-main);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.form-group {
|
| 120 |
+
margin-bottom: 25px;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
label {
|
| 124 |
+
display: block;
|
| 125 |
+
margin-bottom: 8px;
|
| 126 |
+
font-size: 0.9rem;
|
| 127 |
+
color: var(--text-muted);
|
| 128 |
+
font-weight: 600;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
textarea {
|
| 132 |
+
width: 100%;
|
| 133 |
+
background-color: #0a0a0a;
|
| 134 |
+
border: 1px solid var(--border-color);
|
| 135 |
+
color: var(--text-main);
|
| 136 |
+
padding: 15px;
|
| 137 |
+
border-radius: 8px;
|
| 138 |
+
font-family: var(--font-body);
|
| 139 |
+
font-size: 1rem;
|
| 140 |
+
resize: vertical;
|
| 141 |
+
min-height: 100px;
|
| 142 |
+
transition: all 0.3s ease;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
textarea:focus {
|
| 146 |
+
outline: none;
|
| 147 |
+
border-color: var(--primary-color);
|
| 148 |
+
box-shadow: 0 0 10px var(--accent-glow);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.slider-container {
|
| 152 |
+
display: flex;
|
| 153 |
+
flex-direction: column;
|
| 154 |
+
gap: 10px;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
input[type="range"] {
|
| 158 |
+
width: 100%;
|
| 159 |
+
accent-color: var(--primary-color);
|
| 160 |
+
cursor: pointer;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.value-display {
|
| 164 |
+
font-size: 0.85rem;
|
| 165 |
+
color: var(--primary-color);
|
| 166 |
+
font-weight: 700;
|
| 167 |
+
text-align: right;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.btn-generate {
|
| 171 |
+
width: 100%;
|
| 172 |
+
padding: 18px;
|
| 173 |
+
background-color: var(--primary-color);
|
| 174 |
+
color: white;
|
| 175 |
+
border: none;
|
| 176 |
+
border-radius: 8px;
|
| 177 |
+
font-family: var(--font-heading);
|
| 178 |
+
font-size: 1.5rem;
|
| 179 |
+
font-weight: 700;
|
| 180 |
+
cursor: pointer;
|
| 181 |
+
transition: all 0.3s ease;
|
| 182 |
+
position: relative;
|
| 183 |
+
overflow: hidden;
|
| 184 |
+
box-shadow: 0 4px 15px var(--accent-glow);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
.btn-generate:hover {
|
| 188 |
+
background-color: var(--primary-hover);
|
| 189 |
+
transform: translateY(-2px);
|
| 190 |
+
box-shadow: 0 8px 25px var(--accent-glow);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.btn-generate:active {
|
| 194 |
+
transform: translateY(1px);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.btn-generate:disabled {
|
| 198 |
+
background-color: #444;
|
| 199 |
+
cursor: not-allowed;
|
| 200 |
+
box-shadow: none;
|
| 201 |
+
transform: none;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/* --- Canvas / Output Area --- */
|
| 205 |
+
.canvas-container {
|
| 206 |
+
display: flex;
|
| 207 |
+
flex-direction: column;
|
| 208 |
+
align-items: center;
|
| 209 |
+
justify-content: flex-start;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.art-frame {
|
| 213 |
+
width: 100%;
|
| 214 |
+
aspect-ratio: 1 / 1; /* Square canvas */
|
| 215 |
+
background-color: #000;
|
| 216 |
+
border-radius: 16px;
|
| 217 |
+
overflow: hidden;
|
| 218 |
+
position: relative;
|
| 219 |
+
border: 4px solid var(--border-color);
|
| 220 |
+
box-shadow: 0 20px 50px rgba(0,0,0,0.6);
|
| 221 |
+
transition: border-color 0.5s ease;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.art-frame.active-border {
|
| 225 |
+
border-color: var(--primary-color);
|
| 226 |
+
box-shadow: 0 0 30px var(--accent-glow);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
#generated-image {
|
| 230 |
+
width: 100%;
|
| 231 |
+
height: 100%;
|
| 232 |
+
object-fit: cover;
|
| 233 |
+
display: block;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
.placeholder-content {
|
| 237 |
+
width: 100%;
|
| 238 |
+
height: 100%;
|
| 239 |
+
display: flex;
|
| 240 |
+
flex-direction: column;
|
| 241 |
+
align-items: center;
|
| 242 |
+
justify-content: center;
|
| 243 |
+
color: var(--text-muted);
|
| 244 |
+
background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
|
| 245 |
+
text-align: center;
|
| 246 |
+
padding: 40px;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.placeholder-icon {
|
| 250 |
+
font-size: 4rem;
|
| 251 |
+
margin-bottom: 20px;
|
| 252 |
+
color: #333;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
.status-bar {
|
| 256 |
+
margin-top: 20px;
|
| 257 |
+
width: 100%;
|
| 258 |
+
display: flex;
|
| 259 |
+
justify-content: space-between;
|
| 260 |
+
align-items: center;
|
| 261 |
+
color: var(--text-muted);
|
| 262 |
+
font-size: 0.9rem;
|
| 263 |
+
padding: 0 10px;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
.loader {
|
| 267 |
+
display: none;
|
| 268 |
+
width: 40px;
|
| 269 |
+
height: 40px;
|
| 270 |
+
border: 4px solid var(--border-color);
|
| 271 |
+
border-top: 4px solid var(--primary-color);
|
| 272 |
+
border-radius: 50%;
|
| 273 |
+
animation: spin 1s linear infinite;
|
| 274 |
+
margin: 0 auto;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
@keyframes spin {
|
| 278 |
+
0% { transform: rotate(0deg); }
|
| 279 |
+
100% { transform: rotate(360deg); }
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/* --- Responsive Design --- */
|
| 283 |
+
@media (max-width: 900px) {
|
| 284 |
+
main {
|
| 285 |
+
grid-template-columns: 1fr;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.art-frame {
|
| 289 |
+
max-width: 500px;
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
@media (max-width: 600px) {
|
| 294 |
+
.nav-container {
|
| 295 |
+
flex-direction: column;
|
| 296 |
+
gap: 15px;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.brand {
|
| 300 |
+
font-size: 1.5rem;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
.controls-panel {
|
| 304 |
+
padding: 20px;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
h2 {
|
| 308 |
+
font-size: 1.5rem;
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
/* Utility for the footer link */
|
| 313 |
+
.built-with-container {
|
| 314 |
+
display: flex;
|
| 315 |
+
align-items: center;
|
| 316 |
+
gap: 5px;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.built-with-text {
|
| 320 |
+
color: var(--text-muted);
|
| 321 |
+
font-size: 0.8rem;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
.built-with-link {
|
| 325 |
+
color: var(--primary-color);
|
| 326 |
+
text-decoration: none;
|
| 327 |
+
font-size: 0.8rem;
|
| 328 |
+
font-weight: 600;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
</style>
|
| 332 |
+
</head>
|
| 333 |
+
<body>
|
| 334 |
+
|
| 335 |
+
<header>
|
| 336 |
+
<div class="nav-container">
|
| 337 |
+
<a href="#" class="brand">
|
| 338 |
+
Crimson <span>Canvas</span>
|
| 339 |
+
</a>
|
| 340 |
+
|
| 341 |
+
<div class="built-with-container">
|
| 342 |
+
<span class="built-with-text">Built with</span>
|
| 343 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with-link">
|
| 344 |
+
anycoder
|
| 345 |
+
</a>
|
| 346 |
+
</div>
|
| 347 |
+
</div>
|
| 348 |
+
</header>
|
| 349 |
+
|
| 350 |
+
<main>
|
| 351 |
+
<!-- Left Side: Controls -->
|
| 352 |
+
<aside class="controls-panel">
|
| 353 |
+
<h2>New Creation</h2>
|
| 354 |
+
|
| 355 |
+
<div class="form-group">
|
| 356 |
+
<label for="prompt">Art Prompt</label>
|
| 357 |
+
<textarea id="prompt" placeholder="Describe the masterpiece you want to create... e.g., 'A futuristic cyberpunk city with neon rain, cinematic lighting, 8k resolution'"></textarea>
|
| 358 |
+
</div>
|
| 359 |
+
|
| 360 |
+
<div class="form-group">
|
| 361 |
+
<label for="style-select">Art Style</label>
|
| 362 |
+
<select id="style-select" style="width: 100%; padding: 12px; background: #0a0a0a; color: var(--text-main); border: 1px solid var(--border-color); border-radius: 8px; font-family: var(--font-body);">
|
| 363 |
+
<option value="realistic">Photorealistic</option>
|
| 364 |
+
<option value="cyberpunk">Cyberpunk / Sci-Fi</option>
|
| 365 |
+
<option value="fantasy">Fantasy / Epic</option>
|
| 366 |
+
<option value="abstract">Abstract / Geometric</option>
|
| 367 |
+
<option value="oil-painting">Oil Painting Style</option>
|
| 368 |
+
<option value="anime">Anime / Manga</option>
|
| 369 |
+
<option value="noir">Film Noir</option>
|
| 370 |
+
</select>
|
| 371 |
+
</div>
|
| 372 |
+
|
| 373 |
+
<div class="form-group">
|
| 374 |
+
<label for="aspect-ratio">Aspect Ratio</label>
|
| 375 |
+
<div class="slider-container">
|
| 376 |
+
<input type="range" id="aspect-ratio" min="0.5" max="2.0" step="0.1" value="1.0">
|
| 377 |
+
<div class="value-display" id="ratio-display">Square (1:1)</div>
|
| 378 |
+
</div>
|
| 379 |
+
</div>
|
| 380 |
+
|
| 381 |
+
<div class="form-group">
|
| 382 |
+
<label for="creativity">Creativity / Nudging</label>
|
| 383 |
+
<div class="slider-container">
|
| 384 |
+
<input type="range" id="creativity" min="0" max="100" step="5" value="50">
|
| 385 |
+
<div class="value-display" id="creativity-display">50%</div>
|
| 386 |
+
</div>
|
| 387 |
+
</div>
|
| 388 |
+
|
| 389 |
+
<button id="generate-btn" class="btn-generate">
|
| 390 |
+
Generate Art
|
| 391 |
+
</button>
|
| 392 |
+
</aside>
|
| 393 |
+
|
| 394 |
+
<!-- Right Side: Canvas -->
|
| 395 |
+
<section class="canvas-container">
|
| 396 |
+
<div class="art-frame" id="art-frame">
|
| 397 |
+
<div class="placeholder-content" id="placeholder">
|
| 398 |
+
<div class="placeholder-icon">
|
| 399 |
+
<i data-lucide="palette"></i>
|
| 400 |
+
</div>
|
| 401 |
+
<h3>Ready to Create</h3>
|
| 402 |
+
<p style="margin-top: 10px; max-width: 300px;">
|
| 403 |
+
Enter a prompt on the left and click "Generate Art" to see your vision come to life.
|
| 404 |
+
</p>
|
| 405 |
+
</div>
|
| 406 |
+
<div class="loader" id="loader"></div>
|
| 407 |
+
<img id="generated-image" src="" alt="Generated Art" style="display: none;">
|
| 408 |
+
</div>
|
| 409 |
+
|
| 410 |
+
<div class="status-bar">
|
| 411 |
+
<span id="status-text">Waiting for input...</span>
|
| 412 |
+
<span id="seed-display">Seed: -</span>
|
| 413 |
+
</div>
|
| 414 |
+
</section>
|
| 415 |
+
</main>
|
| 416 |
+
|
| 417 |
+
<script>
|
| 418 |
+
// Initialize Lucide Icons
|
| 419 |
+
lucide.createIcons();
|
| 420 |
+
|
| 421 |
+
// DOM Elements
|
| 422 |
+
const generateBtn = document.getElementById('generate-btn');
|
| 423 |
+
const promptInput = document.getElementById('prompt');
|
| 424 |
+
const styleSelect = document.getElementById('style-select');
|
| 425 |
+
const aspectRatioInput = document.getElementById('aspect-ratio');
|
| 426 |
+
const creativityInput = document.getElementById('creativity');
|
| 427 |
+
|
| 428 |
+
const ratioDisplay = document.getElementById('ratio-display');
|
| 429 |
+
const creativityDisplay = document.getElementById('creativity-display');
|
| 430 |
+
|
| 431 |
+
const artFrame = document.getElementById('art-frame');
|
| 432 |
+
const placeholder = document.getElementById('placeholder');
|
| 433 |
+
const loader = document.getElementById('loader');
|
| 434 |
+
const generatedImage = document.getElementById('generated-image');
|
| 435 |
+
const statusText = document.getElementById('status-text');
|
| 436 |
+
const seedDisplay = document.getElementById('seed-display');
|
| 437 |
+
|
| 438 |
+
// Helper to generate random seeds
|
| 439 |
+
function generateRandomSeed() {
|
| 440 |
+
return Math.floor(Math.random() * 1000000);
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// Helper to get placeholder images for demo purposes
|
| 444 |
+
// Using Picsum with random seed to simulate different results
|
| 445 |
+
function getDemoImageURL(seed, width, height) {
|
| 446 |
+
return `https://picsum.photos/seed/${seed}/${width}/${height}?random=${seed}`;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
// Update UI Sliders
|
| 450 |
+
aspectRatioInput.addEventListener('input', (e) => {
|
| 451 |
+
const val = e.target.value;
|
| 452 |
+
ratioDisplay.textContent = val === '1' ? 'Square (1:1)' : `Custom (${val}:1)`;
|
| 453 |
+
|
| 454 |
+
// Adjust aspect ratio of the frame dynamically
|
| 455 |
+
if (val === '1') {
|
| 456 |
+
artFrame.style.aspectRatio = '1 / 1';
|
| 457 |
+
} else {
|
| 458 |
+
artFrame.style.aspectRatio = `${val} / 1`;
|
| 459 |
+
}
|
| 460 |
+
});
|
| 461 |
+
|
| 462 |
+
creativityInput.addEventListener('input', (e) => {
|
| 463 |
+
creativityDisplay.textContent = e.target.value + '%';
|
| 464 |
+
});
|
| 465 |
+
|
| 466 |
+
// Main Generation Logic
|
| 467 |
+
generateBtn.addEventListener('click', async () => {
|
| 468 |
+
const prompt = promptInput.value.trim();
|
| 469 |
+
|
| 470 |
+
if (!prompt) {
|
| 471 |
+
alert("Please enter a prompt to generate your artwork.");
|
| 472 |
+
promptInput.focus();
|
| 473 |
+
return;
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
// 1. UI State: Loading
|
| 477 |
+
generateBtn.disabled = true;
|
| 478 |
+
generateBtn.innerHTML = "Dreaming...";
|
| 479 |
+
artFrame.classList.remove('active-border');
|
| 480 |
+
placeholder.style.display = 'none';
|
| 481 |
+
generatedImage.style.display = 'none';
|
| 482 |
+
loader.style.display = 'block';
|
| 483 |
+
statusText.textContent = "Processing prompt...";
|
| 484 |
+
|
| 485 |
+
// 2. Simulation of AI Processing
|
| 486 |
+
const seed = generateRandomSeed();
|
| 487 |
+
const style = styleSelect.value;
|
| 488 |
+
const creativity = creativityInput.value;
|
| 489 |
+
|
| 490 |
+
// Update status based on inputs
|
| 491 |
+
statusText.innerHTML = `Applying <strong>${style.replace('-', ' ')}</strong> style... (Seed: ${seed})`;
|
| 492 |
+
|
| 493 |
+
// Calculate fake processing time based on creativity (higher creativity = longer time)
|
| 494 |
+
const processingTime = 1500 + (creativity * 20);
|
| 495 |
+
|
| 496 |
+
await new Promise(resolve => setTimeout(resolve, processingTime));
|
| 497 |
+
|
| 498 |
+
// 3. "Generate" Image (Using Picsum for Demo)
|
| 499 |
+
// We construct a URL that roughly matches the aspect ratio
|
| 500 |
+
const currentRatio = parseFloat(aspectRatioInput.value);
|
| 501 |
+
let w = 800;
|
| 502 |
+
let h = 800;
|
| 503 |
+
|
| 504 |
+
if (currentRatio > 1.2) { w = 1000; h = 600; } // Landscape
|
| 505 |
+
else if (currentRatio < 0.8) { w = 600; h = 1000; } // Portrait
|
| 506 |
+
else { w = 800; h = 800; } // Square
|
| 507 |
+
|
| 508 |
+
const imageUrl = getDemoImageURL(seed, w, h);
|
| 509 |
+
|
| 510 |
+
// 4. UI State: Success
|
| 511 |
+
loader.style.display = 'none';
|
| 512 |
+
generatedImage.src = imageUrl;
|
| 513 |
+
generatedImage.onload = () => {
|
| 514 |
+
generatedImage.style.display = 'block';
|
| 515 |
+
artFrame.classList.add('active-border');
|
| 516 |
+
statusText.innerHTML = `Generation complete! <br><small>Style: ${style} | Steps: ${15 + (creativity/2)}</small>`;
|
| 517 |
+
seedDisplay.textContent = `Seed: ${seed}`;
|
| 518 |
+
generateBtn.disabled = false;
|
| 519 |
+
generateBtn.textContent = "Generate Art";
|
| 520 |
+
};
|
| 521 |
+
});
|
| 522 |
+
|
| 523 |
+
// Add a subtle animation to the frame on hover
|
| 524 |
+
artFrame.addEventListener('mouseenter', () => {
|
| 525 |
+
if (!generatedImage.style.display || generatedImage.style.display === 'none') {
|
| 526 |
+
artFrame.style.borderColor = '#555';
|
| 527 |
+
}
|
| 528 |
+
});
|
| 529 |
+
|
| 530 |
+
artFrame.addEventListener('mouseleave', () => {
|
| 531 |
+
if (!generatedImage.style.display || generatedImage.style.display === 'none') {
|
| 532 |
+
artFrame.style.borderColor = '#333';
|
| 533 |
+
} else {
|
| 534 |
+
artFrame.classList.add('active-border');
|
| 535 |
+
}
|
| 536 |
+
});
|
| 537 |
+
|
| 538 |
+
</script>
|
| 539 |
+
</body>
|
| 540 |
+
</html>
|