-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
40 lines (37 loc) · 1.52 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!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.6.0/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/c-frame/aframe-extras@7.5.0/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>