File size: 2,642 Bytes
e44c721 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | // This would contain the React Three Fiber code for the 3D Node.js model
// Simplified placeholder for the actual implementation
document.addEventListener('DOMContentLoaded', () => {
// Initialize the 3D scene
init3DScene();
// Add smooth scroll behavior
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
});
function init3DScene() {
const container = document.getElementById('node-model');
// In a real implementation, this would be React Three Fiber code
// Here's a simplified example of what the structure might look like:
/*
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(container.clientWidth, container.clientHeight);
container.appendChild(renderer.domElement);
// Create a glowing sphere with code texture
const geometry = new THREE.SphereGeometry(2, 32, 32);
const material = new THREE.MeshPhongMaterial({
color: 0x4ade80,
emissive: 0x4ade80,
emissiveIntensity: 0.5,
shininess: 100,
transparent: true,
opacity: 0.9
});
const sphere = new THREE.Mesh(geometry, material);
scene.add(sphere);
// Add ambient and directional light
const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
directionalLight.position.set(1, 1, 1);
scene.add(directionalLight);
camera.position.z = 5;
// Animation loop
function animate() {
requestAnimationFrame(animate);
sphere.rotation.x += 0.005;
sphere.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
// Handle window resize
window.addEventListener('resize', () => {
camera.aspect = container.clientWidth / container.clientHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.clientWidth, container.clientHeight);
});
*/
// For now, we'll just add a placeholder
container.innerHTML = '<div class="w-full h-full flex items-center justify-center bg-gray-800/50 rounded-xl"><p class="text-gray-400">3D Node.js Model Here</p></div>';
} |