Answer the question
In order to leave comments, you need to log in
Preloader for js files. How to show loading animation until js files are loaded?
In my threejs, models in js format are loaded.
I need to hide the scene until the models are fully loaded
Answer the question
In order to leave comments, you need to log in
The script tag has an onload event.
In the simplest version, it is enough to make a counter, in which to place the number of requested resources, and hang a handler on onload, with the decrement of the counter. If it reaches zero, everything is loaded.
Alternatively, load the main JS files. After the event onload / $(document).ready - load large files with models via AJAX.
Thus, you will kill several birds with one stone: the user does not have to wait for the page to fully load, he sees the preloader and understands that he needs to wait more; you will be able to control the download state, "if loaded and connected - then".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question