In AR.js When Load Model ,Show A Loading Screen

When We Load A Big 3D Model Or Big A Video, It Takes Time To Load The Assets(Resources) And Render The Resources,So I Want To Show A Loading Screen Or Loading Gif File or a Loading A-Box - Till The Whole Assets Loading And Rendering Is Done,On The Screen Or On The Pattern.Please Go Through My GLITCH , Its Working But It Will Take 10-15 Sec to load and render.

I tried To Add Asset Loading Manager But It didn't Worked . I Tried All The Ways But It Didn't Worked

<!DOCTYPE html>
<html lang="en">
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <script type="text/javascript" src=""></script>
      <script type="text/javascript" src=""></script>
      <script type="text/javascript" src=""></script>
      <script src="[email protected]/dist/aframe-animation-component.min.js"></script>
      <a-scene vr-mode-ui="enabled: false" artoolkit='sourceType: webcam; detectionMode: mono; maxDetectionRate: 90;' arjs='debugUIEnabled: false;detectionMode: mono_and_matrix; matrixCodeType: 3x3;'>
            <a-entity src="" id="model"></a-entity>
         <a-marker preset="hiro">
            <a-entity  gltf-model="#model" material='transparent:true;shader:flat;side:double;metelness:2' scale="0.04 0.04 0.04" ></a-entity>
         <a-entity camera></a-entity>
         <a-entity shadow="cast: true"></a-entity>
         // Workaround for an AR.js bug (
         const sceneEl = document.querySelector('a-scene');
         sceneEl.addEventListener('loaded', () => {
  = new THREE.PerspectiveCamera();
           scene.add( camera );

After Showing The HIRO Pattern Its Takes 10-15 Seconds (Depending Upon The Internet Speed) To Load And Render . I Want To Show Some Preloader Or Loading Screen Or Some Gif Loading Image To Display Till The Object (Assets) Loads Completely And Render And Disappear Once The Rendering And Loading Is Done......

Thanks In Advance



For models, you can use the model-loaded event:

<a-marker preset="hiro">
   <a-entity id='loadingEl'></a-entity>
   <a-entity gltf-model="#model"></a-entity>

The #loadingEl could have a primitive box with a "loading" image, and when the model is loaded, you remove (the entity or its visibility):

AFRAME.registerComponent('foo', {
   init: function() {
      this.el.addEventListener('model-loaded', e => {

Glitch here.

The <a-assets> system have a loaded event emitted, you could use it for videos as well.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.