From 2688ab2e9a8b0fb37bde487c2534d2e189d69fd4 Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 31 May 2023 02:09:55 +0200 Subject: [PATCH] use clock --- main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 2088c5a..7e8b2a0 100644 --- a/main.js +++ b/main.js @@ -283,8 +283,8 @@ function updateSun() { } else { - const time = performance.now() ; - const hour = ( 8 + time / 1440000 ) % 24 + const time = clock.elapsedTime ; + const hour = ( 8 + time / 1440 ) % 24 const hourAngle = Math.PI * (1-hour/12) elevation = Math.asin( Math.sin(declination)*Math.sin(latitude) + Math.cos(declination)*Math.cos(latitude)*Math.cos(hourAngle) ) azimuth = Math.asin( Math.cos(declination)*Math.sin(hourAngle)/Math.cos(elevation) ) @@ -590,7 +590,7 @@ function animate() { } - const time = performance.now() * 0.001; + const time = clock.elapsedTime; water.material.uniforms[ 'time' ].value += 1.0 / 100.0; raft.rotation.z = 0.12 * Math.cos( 1.2 * time )