From 9c25e30c36158c17c9a44f61b13e7c37dc0889ab Mon Sep 17 00:00:00 2001 From: jkcuk <44874423+jkcuk@users.noreply.github.com> Date: Mon, 11 Mar 2024 22:47:15 +0000 Subject: [PATCH] Cooler transition --- main.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index 1cc489d..a5c27bc 100644 --- a/main.js +++ b/main.js @@ -124,16 +124,19 @@ function init() { addOrbitControls(); // add to outside camera // remove the splash - for(let i=0; i<100; i++) { - setTimeout(() => { - document.getElementById('splash').style.opacity = (100-i)/100; - }, 1000+10*i); + let duration=4000; // duration of transition, in ms + for(let ms=0; ms { + document.getElementById('splash').style.opacity = opacity; + renderer.domElement.style.opacity = 1-opacity; + }, ms); } setTimeout(() => { document.getElementById('splash').style.visibility = "hidden"; // the controls menu createGUI(); - }, 2100); + }, duration+100); }