feat: implement evolution and gradient systems with settings modal

- Add EvolutionController to manage spawning and physics of icons.
- Introduce GradientController for animated gradient backgrounds.
- Create iconLoader for fetching and caching SVG icons.
- Implement modal functionality for settings adjustments.
- Connect UI controls to controllers via SettingsController.
- Add CSS styles for gradient animations, icons, and modal.
- Create utility functions for color manipulation in gradients.
This commit is contained in:
sha
2026-02-21 13:53:46 +02:00
commit 899d9d7c13
59 changed files with 1765 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
/**
* main.js
* Application entry point.
*
* Responsibilities:
* - Instantiate all controllers
* - Wire the settings button to the modal
* - Kick off the gradient and evolution system
*
* Keep this file thin — business logic lives in the controllers.
*/
import { GradientController } from './gradient.js';
import { ModalController } from './modal.js';
import { SettingsController } from './settings.js';
import { EvolutionController } from './evolution.js';
import { DEFAULTS } from './constants.js';
// ── Initialise controllers ─────────────────────────────────
const gradient = new GradientController();
const modal = new ModalController();
const evolution = new EvolutionController();
// SettingsController bridges UI → gradient + evolution
// eslint-disable-next-line no-unused-vars
const settings = new SettingsController(gradient, evolution);
// ── Wire up settings button ────────────────────────────────
document.getElementById('settingsBtn').addEventListener('click', (e) => {
modal.open(/** @type {HTMLElement} */ (e.currentTarget));
});
// ── Boot gradient ──────────────────────────────────────────
gradient.init(DEFAULTS.GRADIENT_COLOR);
// ── Boot evolution (async — loads icons.json + warms SVG cache) ──
evolution.init(document.getElementById('evolutionContainer'));