Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Immersive 3D Portfolio</title> | |
| <style> | |
| /* CSS STYLING */ | |
| body { | |
| margin: 0; | |
| overflow-x: hidden; | |
| background-color: #0d0d0d; | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| color: white; | |
| } | |
| canvas { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| z-index: -1; /* Puts the 3D canvas behind the text */ | |
| } | |
| /* UI Overlay */ | |
| main { | |
| position: relative; | |
| z-index: 1; | |
| padding: 2rem; | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| } | |
| nav { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 20px 0; | |
| } | |
| .logo { | |
| font-size: 1.5rem; | |
| font-weight: bold; | |
| letter-spacing: 2px; | |
| } | |
| .hero { | |
| height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: flex-start; | |
| } | |
| h1 { | |
| font-size: 5rem; | |
| margin: 0; | |
| background: linear-gradient(45deg, #00f260, #0575e6); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| line-height: 1.1; | |
| } | |
| p.subtitle { | |
| font-size: 1.5rem; | |
| color: #ccc; | |
| margin-top: 10px; | |
| max-width: 600px; | |
| } | |
| .btn { | |
| margin-top: 30px; | |
| padding: 15px 35px; | |
| border: 1px solid white; | |
| color: white; | |
| text-decoration: none; | |
| font-weight: bold; | |
| transition: 0.3s; | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| .btn:hover { | |
| background: white; | |
| color: #000; | |
| } | |
| /* Simple content section to show scrolling */ | |
| .content-section { | |
| min-height: 100vh; | |
| display: flex; | |
| align-items: center; | |
| } | |
| h2 { font-size: 3rem; margin-bottom: 20px; } | |
| </style> | |
| </head> | |
| <body> | |
| <main> | |
| <nav> | |
| <div class="logo">PORTFOLIO</div> | |
| <div> | |
| <a href="work.html" style="color: white; text-decoration: none; margin-left: 20px;">Work</a> | |
| <a href="about.html" style="color: white; text-decoration: none; margin-left: 20px;">About</a> | |
| <a href="contact.html" style="color: white; text-decoration: none; margin-left: 20px;">Contact</a> | |
| </div> | |
| </nav> | |
| <section class="hero"> | |
| <h1>SIMRANPREET KAUR </h1> | |
| <p class="subtitle">Building immersive digital experiences with code and creativity.</p> | |
| <a href="projects.html" class="btn">View Projects</a> | |
| </section> | |
| <section class="content-section"> | |
| <div> | |
| <h2>Selected Work</h2> | |
| <p>Scroll down to see projects interacting with the 3D environment...</p> | |
| </div> | |
| </section> | |
| </main> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> | |
| <script> | |
| // JAVASCRIPT FOR 3D VISUALS | |
| // 1. Scene Setup | |
| const scene = new THREE.Scene(); | |
| // Add a subtle fog for depth | |
| scene.fog = new THREE.FogExp2(0x0d0d0d, 0.002); | |
| const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); | |
| const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); | |
| renderer.setSize(window.innerWidth, window.innerHeight); | |
| renderer.setPixelRatio(window.devicePixelRatio); | |
| document.body.appendChild(renderer.domElement); | |
| // 2. Create the Main Object (Torus Knot) | |
| const geometry = new THREE.TorusKnotGeometry(10, 3, 100, 16); | |
| // Wireframe material gives a "tech" look | |
| const material = new THREE.MeshBasicMaterial({ | |
| color: 0x00f260, | |
| wireframe: true, | |
| transparent: true, | |
| opacity: 0.3 | |
| }); | |
| const torusKnot = new THREE.Mesh(geometry, material); | |
| scene.add(torusKnot); | |
| // 3. Create Particles (Starfield effect) | |
| const particlesGeometry = new THREE.BufferGeometry(); | |
| const particlesCount = 700; | |
| const posArray = new Float32Array(particlesCount * 3); | |
| for(let i = 0; i < particlesCount * 3; i++) { | |
| // Spread particles randomly | |
| posArray[i] = (Math.random() - 0.5) * 50; | |
| } | |
| particlesGeometry.setAttribute('position', new THREE.BufferAttribute(posArray, 3)); | |
| const particlesMaterial = new THREE.PointsMaterial({ | |
| size: 0.05, | |
| color: 0xffffff, | |
| }); | |
| const particlesMesh = new THREE.Points(particlesGeometry, particlesMaterial); | |
| scene.add(particlesMesh); | |
| // Position Camera | |
| camera.position.z = 30; | |
| // 4. Mouse Interaction | |
| let mouseX = 0; | |
| let mouseY = 0; | |
| document.addEventListener('mousemove', (event) => { | |
| mouseX = event.clientX; | |
| mouseY = event.clientY; | |
| }); | |
| // 5. Animation Loop | |
| const clock = new THREE.Clock(); | |
| function animate() { | |
| const elapsedTime = clock.getElapsedTime(); | |
| // Rotate main object | |
| torusKnot.rotation.y = elapsedTime * 0.1; | |
| torusKnot.rotation.x = elapsedTime * 0.05; | |
| // Rotate particles slowly | |
| particlesMesh.rotation.y = -elapsedTime * 0.05; | |
| // Interactive movement based on mouse | |
| // We smoothly interpolate the rotation for a "fluid" feel | |
| particlesMesh.rotation.x += 0.0005 * (mouseY - window.innerHeight / 2) * 0.001; | |
| particlesMesh.rotation.y += 0.0005 * (mouseX - window.innerWidth / 2) * 0.001; | |
| renderer.render(scene, camera); | |
| requestAnimationFrame(animate); | |
| } | |
| animate(); | |
| // 6. Handle Window Resize | |
| window.addEventListener('resize', () => { | |
| camera.aspect = window.innerWidth / window.innerHeight; | |
| camera.updateProjectionMatrix(); | |
| renderer.setSize(window.innerWidth, window.innerHeight); | |
| }); | |
| </script> | |
| </body> | |
| </html> |