AWAIS310's picture
This is the first section of my 3D Node.js developer portfolio website.
e44c721 verified
Raw History Blame Contribute Delete
2.64 kB
// 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>';
}