diff --git a/app.js b/app.js index b549577..485320f 100644 --- a/app.js +++ b/app.js @@ -3,6 +3,7 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; +import { LoadingManager } from 'three'; // === COLOR PALETTE === const NEXUS = { @@ -16,6 +17,26 @@ const NEXUS = { } }; +// === ASSET LOADER === +const loadedAssets = new Map(); + +const loadingManager = new THREE.LoadingManager(() => { + document.getElementById('loading-bar').style.width = '100%'; + document.getElementById('loading').style.display = 'none'; + animate(); +}); + +loadingManager.onProgress = (url, itemsLoaded, itemsTotal) => { + const progress = (itemsLoaded / itemsTotal) * 100; + document.getElementById('loading-bar').style.width = `${progress}%`; +}; + +// Simulate loading a texture for demonstration +const textureLoader = new THREE.TextureLoader(loadingManager); +textureLoader.load('placeholder-texture.jpg', (texture) => { + loadedAssets.set('placeholder-texture', texture); +}); + // === SCENE SETUP === const scene = new THREE.Scene(); scene.background = new THREE.Color(NEXUS.colors.bg); @@ -327,6 +348,7 @@ const clock = new THREE.Clock(); * @returns {void} */ function animate() { + // Only start animation after assets are loaded requestAnimationFrame(animate); const elapsed = clock.getElapsedTime(); @@ -591,6 +613,9 @@ async function initCommitBanners() { { hash: 'm0n1o2p', message: 'feat: overview mode bird\'s-eye view' }, { hash: 'q3r4s5t', message: 'feat: star field and constellation lines' }, ]; + + // Load commit banners after assets are ready + initCommitBanners(); } const spreadX = [-7, -3.5, 0, 3.5, 7]; diff --git a/index.html b/index.html index 5e67846..795f24e 100644 --- a/index.html +++ b/index.html @@ -49,5 +49,8 @@
⚡ SOVEREIGNTY ⚡
+
+
+