Files
the-nexus/app.js
Alexander Whitestone aa65e39bfe
Some checks failed
CI / validate (pull_request) Failing after 14s
CI / auto-merge (pull_request) Has been skipped
feat: wire effects/ modules into app.js via globalTicker (Refs #413)
- init all 6 effects modules in app.js (matrix-rain, lightning, energy-beam, rune-ring, gravity-zones, shockwave)
- subscribe each to globalTicker; tick() called in the RAF loop
- add subscribe() named export to core/ticker.js for panels compatibility
- bridge data to core/state.js: zoneIntensity from heatmap.js, activeAgentCount + commitHashes from data/gitea.js, portals from portals.js
- update portals.js and weather.js to use new effects/rune-ring and effects/gravity-zones instead of legacy effects.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 18:17:37 -04:00

67 lines
2.6 KiB
JavaScript

// === THE NEXUS — Main Entry Point ===
import * as THREE from 'three';
import { S, Broadcaster } from './modules/state.js';
import { NEXUS } from './modules/constants.js';
import { scene, camera, renderer, composer } from './modules/scene-setup.js';
import { clock, warpPass } from './modules/warp.js';
import { nostr } from './modules/nostr.js';
import { createNostrPanelTexture } from './modules/nostr-panel.js';
import { state } from './modules/core/state.js';
import { globalTicker } from './modules/core/ticker.js';
import * as matrixRain from './modules/effects/matrix-rain.js';
import * as lightning from './modules/effects/lightning.js';
import * as energyBeam from './modules/effects/energy-beam.js';
import * as runeRing from './modules/effects/rune-ring.js';
import * as gravityZones from './modules/effects/gravity-zones.js';
import * as shockwave from './modules/effects/shockwave.js';
// === NOSTR INIT ===
nostr.connect();
const { canvas: nostrCanvas, update: updateNostrUI } = createNostrPanelTexture();
const nostrTexture = new THREE.CanvasTexture(nostrCanvas);
const nostrMat = new THREE.MeshBasicMaterial({ map: nostrTexture, transparent: true, side: THREE.DoubleSide });
const nostrPanel = new THREE.Mesh(new THREE.PlaneGeometry(3, 3), nostrMat);
nostrPanel.position.set(-6, 3.5, -7.5);
nostrPanel.rotation.y = 0.4;
scene.add(nostrPanel);
// === EFFECTS INIT ===
matrixRain.init(scene, state, NEXUS);
lightning.init(scene, state, NEXUS);
energyBeam.init(scene, state, NEXUS);
runeRing.init(scene, state, NEXUS);
gravityZones.init(scene, state, NEXUS);
shockwave.init(scene, state, NEXUS, { clock });
globalTicker.subscribe((delta, elapsed) => matrixRain.update(elapsed, delta));
globalTicker.subscribe((delta, elapsed) => lightning.update(elapsed, delta));
globalTicker.subscribe((delta, elapsed) => energyBeam.update(elapsed, delta));
globalTicker.subscribe((delta, elapsed) => runeRing.update(elapsed, delta));
globalTicker.subscribe((delta, elapsed) => gravityZones.update(elapsed, delta));
globalTicker.subscribe((delta, elapsed) => shockwave.update(elapsed, delta));
// === MAIN ANIMATION LOOP ===
function animate() {
requestAnimationFrame(animate);
const delta = clock.getDelta();
const elapsed = clock.elapsedTime;
globalTicker.tick(delta, elapsed);
// Update Nostr UI periodically or on event
if (Math.random() > 0.95) {
updateNostrUI();
nostrTexture.needsUpdate = true;
}
// Visual pulse on energy beam
if (S.energyBeamPulse > 0) {
S.energyBeamPulse -= delta * 2;
if (S.energyBeamPulse < 0) S.energyBeamPulse = 0;
}
composer.render();
}
animate();
console.log('Nexus Sovereign Node: NOSTR CONNECTED.');