Browse Source

Removed unnecessary animation loop (#25018)

WestLangley 2 years ago
parent
commit
b44d661e4b
1 changed files with 4 additions and 4 deletions
  1. 4 4
      examples/webgl_materials_wireframe.html

+ 4 - 4
examples/webgl_materials_wireframe.html

@@ -89,6 +89,7 @@
 				camera.position.z = 200;
 
 				const controls = new OrbitControls( camera, renderer.domElement );
+				controls.addEventListener( 'change', render ); // use if there is no animation loop
 				controls.enablePan = false;
 				controls.enableZoom = false;
 
@@ -133,7 +134,7 @@
 
 					//
 
-					animate();
+					render();
 
 				} );
 
@@ -144,6 +145,7 @@
 				gui.add( API, 'thickness', 0, 4 ).onChange( function () {
 
 					mesh2.material.uniforms.thickness.value = API.thickness;
+					render();
 
 				} );
 
@@ -185,9 +187,7 @@
 
 			}
 
-			function animate() {
-
-				requestAnimationFrame( animate );
+			function render() {
 
 				renderer.render( scene, camera );