javascript - Three.js: Cannot change Boolean value in onLoad function -


i using three.js loading manager start , stop requestionanimationframe animation loop. have this:

var loadingmanager = new three.loadingmanager(); var isloaded = new boolean();      loadingmanager.onload = function () {         isloaded = true;     };      function startanimationloop() {       if (!runanimation) {         runanimation= animationdisplay.requestanimationframe(animate);       }     }      function stopanimationloop() {       if (runanimation) {         animationdisplay.cancelanimationframe(runanimation);         runanimation= undefined;       }     } 

and what's in render loop:

if (isloaded == true) {   startanimationloop(); //not working  } else if (isloaded == false) {   stopanimationloop(); } 

it seems isloaded has not been set true in onload function animation loop not start. doing wrong here? in advance.

need make object of objloader

var loader = new three.objloader( loadingmanager ); 

then need call load function

loader.load( 'loadingmanager', function ( object ) { } 

refer three.js doc


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -