UNPKG

aframe-dust-component

Version:

A cloud of particles surrounding the user for visual motion indication, or atmosphere. For A-Frame WebVR.

41 lines (37 loc) 1.56 kB
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>dust test - A-Frame</title> <meta name="description" content=""> <script src="https://aframe.io/releases/1.4.1/aframe.min.js"></script> <!--<script src="https://rawgit.com/aframevr/aframe/master/dist/aframe-master.min.js"></script>--> <script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@fb96ab2/dist/aframe-extras.controls.min.js"></script> <script src="requestIdleCallback.js"></script> <script src="aframe-dust-component.js"></script> <script> AFRAME.registerComponent('dust-test', { init: function () { let sceneEl = this.el; console.log("dust-test init"); let cameraEl = sceneEl.querySelector('[camera]'); let dustEl = sceneEl.querySelector('a-dust'); // delays setup until there's some slack time requestIdleCallback( () => { dustEl.components.dust.setCamera(cameraEl); }); } }); </script> </head> <body> <a-scene dust-test background="color:#87CEEB"> <a-cone position="0 10 0" color="green" height="20" radius-bottom="20" radius-top="10"></a-cone> <a-dust num-points="5000" dispersion="100" color="red" log=true></a-dust> <a-entity id="rig" movement-controls="fly:true; speed:0.6;" position="0 0 500"> <a-entity camera look-controls position="0 1.6 0"></a-entity> </a-entity> <a-entity button-controls></a-entity> </a-scene> </body> </html>