feat: wire effects/ modules into app.js via globalTicker (Refs #413)
Some checks failed
CI / validate (pull_request) Failing after 14s
CI / auto-merge (pull_request) Has been skipped

- 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>
This commit is contained in:
Alexander Whitestone
2026-03-24 18:17:37 -04:00
parent c0a673038b
commit aa65e39bfe
6 changed files with 37 additions and 4 deletions

24
app.js
View File

@@ -6,6 +6,14 @@ 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();
@@ -17,11 +25,27 @@ 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) {

View File

@@ -8,3 +8,4 @@ export class Ticker {
}
}
export const globalTicker = new Ticker();
export function subscribe(fn) { globalTicker.subscribe(fn); }

View File

@@ -1,6 +1,7 @@
// modules/data/gitea.js — All Gitea API calls
// Writes to S: _activeAgentCount, _matrixCommitHashes, agentStatus
import { S } from '../state.js';
import { state } from '../core/state.js';
const GITEA_BASE = 'http://143.198.27.163:3000/api/v1';
const GITEA_TOKEN = 'dc0517a965226b7a0c5ffdd961b1ba26521ac592';
@@ -122,6 +123,7 @@ export async function refreshCommitData() {
S._matrixCommitHashes = commits.slice(0, 20)
.map(c => (c.sha || '').slice(0, 7))
.filter(h => h.length > 0);
state.commitHashes = S._matrixCommitHashes;
return commits;
}
@@ -129,12 +131,14 @@ export async function refreshAgentData() {
try {
const data = await fetchAgentStatus();
S._activeAgentCount = data.agents.filter(a => a.status === 'working').length;
state.activeAgentCount = S._activeAgentCount;
return data;
} catch {
const fallback = { agents: AGENT_NAMES.map(n => ({
name: n.toLowerCase(), status: 'unreachable', issue: null, prs_today: 0, local: false,
})) };
S._activeAgentCount = 0;
state.activeAgentCount = 0;
return fallback;
}
}

View File

@@ -3,6 +3,7 @@ import * as THREE from 'three';
import { scene } from './scene-setup.js';
import { GLASS_RADIUS } from './platform.js';
import { S } from './state.js';
import { state } from './core/state.js';
import { refreshCommitData } from './data/gitea.js';
const HEATMAP_SIZE = 512;
@@ -118,6 +119,7 @@ export async function updateHeatmap() {
const MAX_WEIGHT = 8;
for (const zone of HEATMAP_ZONES) {
zoneIntensity[zone.name] = Math.min(rawWeights[zone.name] / MAX_WEIGHT, 1.0);
state.zoneIntensity[zone.name] = zoneIntensity[zone.name];
}
drawHeatmap();

View File

@@ -1,9 +1,10 @@
// === PORTALS ===
import * as THREE from 'three';
import { scene } from './scene-setup.js';
import { rebuildRuneRing, setPortalsRef } from './effects.js';
import { rebuild as rebuildRuneRing } from './effects/rune-ring.js';
import { setPortalsRefAudio, startPortalHums } from './audio.js';
import { S } from './state.js';
import { state } from './core/state.js';
import { fetchPortals as fetchPortalData } from './data/loaders.js';
export const portalGroup = new THREE.Group();
@@ -50,8 +51,8 @@ export function setRunPortalHealthChecksFn(fn) { _runPortalHealthChecksFn = fn;
export async function loadPortals() {
try {
portals = await fetchPortalData();
state.portals = portals;
console.log('Loaded portals:', portals);
setPortalsRef(portals);
setPortalsRefAudio(portals);
createPortals();
rebuildRuneRing();

View File

@@ -2,7 +2,8 @@
import * as THREE from 'three';
import { scene, ambientLight } from './scene-setup.js';
import { cloudMaterial } from './platform.js';
import { rebuildRuneRing } from './effects.js';
import { rebuild as rebuildRuneRing } from './effects/rune-ring.js';
import { rebuildFromPortals } from './effects/gravity-zones.js';
import { S } from './state.js';
import { fetchWeatherData } from './data/weather.js';
@@ -40,7 +41,7 @@ export async function runPortalHealthChecks() {
}
rebuildRuneRing();
if (_rebuildGravityZonesFn) _rebuildGravityZonesFn();
rebuildFromPortals();
if (_portalGroupRef) {
for (const child of _portalGroupRef.children) {