import * as THREE from 'three'; import './lib/chrome.js'; import { bindWorld } from './lib/transit.js'; // Landing page backdrop: a slowly turning seed of life and icosahedron drawn in // faint orange lines behind the cards. No controls, no stats - just ambience. const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 100 ); camera.position.z = 14; const renderer = new THREE.WebGLRenderer( { antialias: true, alpha: true } ); renderer.setPixelRatio( Math.min( window.devicePixelRatio, 2 ) ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.domElement.classList.add( 'landing-bg' ); document.body.appendChild( renderer.domElement ); window.addEventListener( 'resize', () => { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); } ); const group = new THREE.Group(); scene.add( group ); const updateWorld = bindWorld( group ); const ringMaterial = new THREE.MeshBasicMaterial( { color: 0xf44f04, opacity: 0.35, transparent: true } ); const ringGeometry = new THREE.TorusGeometry( 2, 0.015, 16, 128 ); // seed of life: one central ring plus six on its circumference const centreRing = new THREE.Mesh( ringGeometry, ringMaterial ); group.add( centreRing ); for ( let i = 0; i < 6; i++ ) { const angle = ( i / 6 ) * Math.PI * 2; const ring = new THREE.Mesh( ringGeometry, ringMaterial ); ring.position.set( 2 * Math.cos( angle ), 2 * Math.sin( angle ), 0 ); group.add( ring ); } const icosa = new THREE.LineSegments( new THREE.EdgesGeometry( new THREE.IcosahedronGeometry( 5.2 ) ), new THREE.LineBasicMaterial( { color: 0xf44f04, opacity: 0.25, transparent: true } ) ); group.add( icosa ); function animate() { requestAnimationFrame( animate ); // in-plane rotation only: the flower turns with the site, never edge-on const time = performance.now() / 1000; group.rotation.z = time * 0.05; icosa.rotation.z = -time * 0.08; updateWorld(); renderer.render( scene, camera ); } animate();