I’m doing a list of exercises and one of them is to edit this code:
function main() {
renderer = new THREE.WebGLRenderer();
renderer.setClearColor(new THREE.Color(0.0, 0.0, 0.0));
renderer.setSize(window.innerWidth*0.8, window.innerHeight*0.8);
document.getElementById("threejs-canvas").appendChild(renderer.domElement);
window.addEventListener("resize", onWindowResize, false);
scene = new THREE.Scene();
camera = new THREE.Camera();
renderer.render(scene, camera);
anime();
};
function anime(time) {
timer.update(time);
sum_delta += timer.getDelta();
if (sum_delta > 1.0) {
renderer.setClearColor(new THREE.Color(Math.random(), Math.random(), Math.random()));
renderer.render(scene, camera);
sum_delta = 0.0;
}
requestAnimationFrame(anime);
};
The idea is to make the color change “smooth” instead of a sudden jump from one color to the next. Given this is meant to be a starter question, can anybody give me some help?