-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio.html
60 lines (53 loc) · 2.05 KB
/
audio.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="aframe-audio-analyser.umd.js"></script>
<script src="color-on-beat.js"></script>
<script src="ring-on-beat.js"></script>
<script src="toggle-on-beat.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<img id="floor" src="https://cdn.aframe.io/a-painter/images/floor.jpg" crossorigin="anonymous" />
<img id="skymap" src="https://cdn.aframe.io/a-painter/images/sky.jpg" crossorigin="anonymous" />
<audio id="song" src="U.mp3" autoplay ></audio>
</a-assets>
<a-entity id="analyser" audioanalyser="src:#song;"></a-entity>
<a-box
position="-2 0.5 -4"
ring-on-beat="analyserEl:#analyser; beat:low;"
color-on-beat="analyserEl:#analyser; beat:low;"
>
<a-text position="0 .75 0" align="center" value="Low Beat"></a-text>
<a-light
type="spot"
color="#faa"
position="0 1 0"
rotation="-90 0 0"
toggle-on-beat="analyserEl:#analyser; beat:low;"
></a-light>
</a-box>
<a-box position="0 0.5 -4" color-on-beat="analyserEl:#analyser; beat:mid;">
<a-text position="0 .75 0" align="center" value="Mid Beat"></a-text>
</a-box>
<a-box position="2 0.5 -4" color-on-beat="analyserEl:#analyser; beat:high;">
<a-text position="0 .75 0" align="center" value="High Beat"></a-text>
</a-box>
<a-light type="ambient" color="#222"></a-light>
<a-light type="point" position="1 2 1"></a-light>
<a-light type="point" position="-2 2 1"></a-light>
<a-entity
id="sky"
geometry="primitive: sphere; radius: 30; phiLength: 360; phiStart: 0; thetaLength: 90"
material="shader: flat; side: back; height: 2048; src: #skymap; width: 2048"
></a-entity>
<a-entity
id="ground"
geometry="primitive: circle; radius: 30.5"
rotation="-90 0 0"
material="src: #floor"
></a-entity>
</a-scene>
</body>
</html>