Spaces:
Running
Running
File size: 6,844 Bytes
17e4170 |
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
<!DOCTYPE html>
<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> |