let mesh; function init() { let geometry = new THREE.IcosahedronGeometry( 0.1 ); let material = new THREE.MeshStandardMaterial( { roughness: 0.2, metalness: 0.5 } ); mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); } function update( time ) { mesh.material.color.setHSL( time / 1000, 0.5, 0.5 ); mesh.position.y = Math.sin( time / 1000 ) * 0.5 + 0.5; mesh.rotation.set( time / 1000, time / 2000, 0 ); }