From c7991d350df67e6fcb67ebcfb5022471ff632c30 Mon Sep 17 00:00:00 2001 From: Daniel Jones <104509116+DanielReddJones@users.noreply.github.com> Date: Mon, 6 May 2024 15:35:29 -0500 Subject: [PATCH] scrolls faster now --- main.js | 14 ++++++++++---- style.css | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 4c0ed8a..cbd92ef 100644 --- a/main.js +++ b/main.js @@ -42,16 +42,17 @@ scene.add(ambientLight, pointLight); pointLight.position.set(10, 10, 10); -const lightHelper = new THREE.PointLightHelper(pointLight); -//turning off orbit controls, not needed. Kept in code in case if I want to use it again. + +//turning off orbit controls and lighthelper. Not needed. Kept in code in case if I want to use it again. +//const lightHelper = new THREE.PointLightHelper(pointLight); //const controls = new OrbitControls(camera, renderer.domElement); -//beggining of creating floor +//floor object that appears in the background const floorTexture = new THREE.TextureLoader().load("marble.jpg"); floorTexture.wrapT = THREE.RepeatWrapping; floorTexture.wrapS = THREE.RepeatWrapping; @@ -65,11 +66,16 @@ floor.rotateX(Math.PI * -0.5); scene.add(floor); +//when the user scrolls, walk down the hallway. function updateCamera(ev){ let div1 = document.getElementById("div1"); - camera.position.z = 10 - window.scrollY / 500.0; + camera.position.z = 10 - window.scrollY; } window.addEventListener("scroll", updateCamera); + + + +//animation loop every cycle. function animate(){ requestAnimationFrame(animate); renderer.render(scene, camera); diff --git a/style.css b/style.css index 534da22..ea2a506 100644 --- a/style.css +++ b/style.css @@ -27,4 +27,9 @@ body { top: 0; width: calc(100% - 2*48px); word-wrap: break-word; +} + +.div1 { + background-color: black; + } \ No newline at end of file