buildar / awe.js

The jQuery for the Augmented Web
515 stars 113 forks source link

Loading, progress bar #19

Closed elektrikmoonkey closed 7 years ago

elektrikmoonkey commented 8 years ago

Hi there, does anyone know how to create a loading bar on geo location example? Going around in circles and still at point 0.

elektrikmoonkey commented 8 years ago

For those ho seek the loading bar. A tricky dirty way is this: Html div <progress id='p' class='determinate' value='0' max='100'></progress>

Then you need to find awe-standard-dependencies.js line 224 - 230 "THREE.XHRLoader.prototype"

    var pBar = document.getElementById("p");
    void 0 !== b && f.addEventListener("progress", function (a) {
        if (a.lengthComputable) {
            var total = a.total;
            var percentComplete = a.loaded / total * 100;
            var percent = Math.round(percentComplete, 2);            

            pBar.value = percent;
            if (percent >= 100) {
               progress.style.display = "none";     
            };
        }
    }, !1);

Hope it helps, maybe you can move this code to another place

robman commented 7 years ago

Hi @elektrikmoonkey - apologies for the lack of replies while we were in stealth mode. Checkout the code in our new repos at https://github.com/awe-media/awe.js - this now includes support for progress_callback handling. The wiki now includes some docs and we'll add a page on progress handling soon.