awacke1 commited on
Commit
d09a488
·
1 Parent(s): 39b0e4f

Upload index.htm

Browse files
Files changed (1) hide show
  1. index.htm +69 -0
index.htm ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>Dynamic Lights - A-Frame</title>
6
+ <meta name="description" content="Dynamic Lights - A-Frame">
7
+ <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
8
+ <script src="https://unpkg.com/[email protected]/dist/aframe-randomizer-components.min.js"></script>
9
+ <script src="https://unpkg.com/[email protected]/dist/aframe-entity-generator-component.min.js"></script>
10
+ <script>
11
+ AFRAME.registerComponent('random-material', {
12
+ init: function () {
13
+ this.el.setAttribute('material', {
14
+ color: this.getRandomColor(),
15
+ metalness: Math.random(),
16
+ roughness: Math.random()
17
+ });
18
+ },
19
+
20
+ getRandomColor: function () {
21
+ var letters = '0123456789ABCDEF'.split('');
22
+ var color = '#';
23
+ for (var i = 0; i < 6; i++) {
24
+ color += letters[Math.floor(Math.random() * 16)];
25
+ }
26
+ return color;
27
+ }
28
+ });
29
+
30
+ AFRAME.registerComponent('random-torus-knot', {
31
+ init: function () {
32
+ this.el.setAttribute('geometry', {
33
+ primitive: 'torusKnot',
34
+ radius: Math.random() * 10,
35
+ radiusTubular: Math.random() * .75,
36
+ p: Math.round(Math.random() * 10),
37
+ q: Math.round(Math.random() * 10)
38
+ });
39
+ }
40
+ });
41
+ </script>
42
+ </head>
43
+ <body>
44
+ <a-scene background="color: #111">
45
+ <a-assets>
46
+ <a-mixin id="light"
47
+ geometry="primitive: sphere; radius: 1.5"
48
+ material="color: #FFF; shader: flat"
49
+ light="color: #DDDDFF; distance: 120; intensity: 2; type: point"></a-mixin>
50
+ <a-mixin id="torusKnot"
51
+ random-torus-knot
52
+ random-material
53
+ random-position="min: -60 -60 -80; max: 60 60 40"></a-mixin>
54
+ </a-assets>
55
+
56
+ <!-- Use entity-generator component to generate 120 entities with the torusKnot mixin. -->
57
+ <a-entity entity-generator="mixin: torusKnot; num: 120"></a-entity>
58
+
59
+ <!-- Lights. -->
60
+ <a-entity animation="property: rotation; to: 0 0 360; dur: 4000; easing: linear; loop: true">
61
+ <a-entity mixin="light" position="30 0 0"></a-entity>
62
+ </a-entity>
63
+
64
+ <a-entity animation="property: rotation; to: 360 0 0; dur: 4000; easing: linear; loop: true">
65
+ <a-entity mixin="light" position="0 0 40"></a-entity>
66
+ </a-entity>
67
+ </a-scene>
68
+ </body>
69
+ </html>