Complete 3D metaverse platform with: - Three.js 3D rendering - Cannon.js physics engine - Pointer lock controls - Procedural cityscape - Floating islands - Portal system - Particle effects - WebXR/VR support ready - Multiplayer ready (Socket.io) Features: - First-person controls (WASD + mouse) - Jump and run mechanics - Chat system - Real-time HUD - Loading screen - Responsive design Built with Vite for fast builds and hot reload. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
629 B
JavaScript
48 lines
629 B
JavaScript
class Animation {
|
|
|
|
constructor( nodes, info ) {
|
|
|
|
this.nodes = nodes;
|
|
this.info = info;
|
|
|
|
this.animationLoop = null;
|
|
this.requestId = null;
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
_init() {
|
|
|
|
const update = ( time, frame ) => {
|
|
|
|
this.requestId = self.requestAnimationFrame( update );
|
|
|
|
this.nodes.nodeFrame.update();
|
|
|
|
this.info.frame = this.nodes.nodeFrame.frameId;
|
|
|
|
if ( this.animationLoop !== null ) this.animationLoop( time, frame );
|
|
|
|
};
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
dispose() {
|
|
|
|
self.cancelAnimationFrame( this.requestId );
|
|
|
|
}
|
|
|
|
setAnimationLoop( callback ) {
|
|
|
|
this.animationLoop = callback;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default Animation;
|