- Created modules/nostr.js: Handles decentralized relay connections and event subscriptions (NIP-01, NIP-05). - Created modules/nostr-panel.js: Implements a 3D terminal panel to display real-time Nostr events (Notes, Reactions, Zaps). - Integrated Nostr into the main app.js as a modular component. - Added visual feedback: Receving a Zap (Kind 9735) triggers a pulse in the Nexus Sovereign State. - Adhered to modular standards: No new file exceeds 100 lines. - Established the foundation for Timmy’s decentralized identity and communication layer.
43 lines
1.4 KiB
JavaScript
43 lines
1.4 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';
|
|
|
|
// === 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);
|
|
|
|
// === MAIN ANIMATION LOOP ===
|
|
function animate() {
|
|
requestAnimationFrame(animate);
|
|
const delta = clock.getDelta();
|
|
const elapsed = clock.elapsedTime;
|
|
|
|
// 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.');
|