WEBLEB
Inicio
Editora de código
Iniciar sesión
Pro
Español
English
Français
Español
Português
Deutsch
Italiano
हिंदी
HTML
CSS
JS
window.addEventListener('mousemove', (e) => { mouse.x = (e.clientX / window.innerWidth) * 2 - 1; mouse.y = -(e.clientY / window.innerHeight) * 2 + 1; }); function updateUI(scrollX) { const rawIndex = Math.round(scrollX / CONFIG.spacingX); const safeIndex = ((rawIndex % CONFIG.slideCount) + CONFIG.slideCount) % CONFIG.slideCount; for(let i=0; i
{ const originalX = i * CONFIG.spacingX; const distFromCam = currentScroll - originalX; const shift = Math.round(distFromCam / totalGalleryWidth) * totalGalleryWidth; group.position.x = originalX + shift; }); camera.rotation.x = mouse.y * 0.05; camera.rotation.y = -mouse.x * 0.05; updateUI(currentScroll); renderer.render(scene, camera); } window.addEventListener('resize', () => { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); }); animate();