| document.addEventListener('DOMContentLoaded', () => { |
| |
| VANTA.NET({ |
| el: "#vanta-bg", |
| color: 0x7e22ce, |
| backgroundColor: 0x0, |
| points: 12.00, |
| maxDistance: 22.00, |
| spacing: 18.00 |
| }); |
|
|
| |
| const initThreeJS = () => { |
| const container = document.getElementById('threejs-container'); |
| const width = container.clientWidth; |
| const height = container.clientHeight; |
|
|
| const scene = new THREE.Scene(); |
| const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000); |
| const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); |
| |
| renderer.setSize(width, height); |
| renderer.setPixelRatio(window.devicePixelRatio); |
| container.appendChild(renderer.domElement); |
|
|
| |
| const ambientLight = new THREE.AmbientLight(0x404040); |
| scene.add(ambientLight); |
|
|
| const directionalLight = new THREE.DirectionalLight(0xffffff, 1); |
| directionalLight.position.set(1, 1, 1); |
| scene.add(directionalLight); |
|
|
| |
| const geometry = new THREE.IcosahedronGeometry(2, 1); |
| const material = new THREE.MeshPhongMaterial({ |
| color: 0x7e22ce, |
| emissive: 0x3b0764, |
| emissiveIntensity: 0.5, |
| specular: 0x7b34dd, |
| shininess: 50, |
| wireframe: false |
| }); |
| const mesh = new THREE.Mesh(geometry, material); |
| scene.add(mesh); |
|
|
| camera.position.z = 5; |
|
|
| |
| const animate = () => { |
| requestAnimationFrame(animate); |
| mesh.rotation.x += 0.005; |
| mesh.rotation.y += 0.01; |
| renderer.render(scene, camera); |
| }; |
| animate(); |
|
|
| |
| window.addEventListener('resize', () => { |
| camera.aspect = container.clientWidth / container.clientHeight; |
| camera.updateProjectionMatrix(); |
| renderer.setSize(container.clientWidth, container.clientHeight); |
| }); |
|
|
| |
| document.getElementById('enter-vr').addEventListener('click', () => { |
| alert('VR functionality would be implemented here with WebXR'); |
| }); |
| }; |
|
|
| initThreeJS(); |
|
|
| |
| const observer = new IntersectionObserver((entries) => { |
| entries.forEach(entry => { |
| if (entry.isIntersecting) { |
| entry.target.classList.add('animate-fadeIn'); |
| } |
| }); |
| }, { threshold: 0.1 }); |
|
|
| document.querySelectorAll('.animate-on-scroll').forEach(el => { |
| observer.observe(el); |
| }); |
| }); |
|
|
| |