-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic-scene.html
48 lines (38 loc) · 1.59 KB
/
basic-scene.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
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<audio src="https://cdn.aframe.io/basic-guide/audio/backgroundnoise.wav" autoplay preload></audio>
</a-assets>
<a-box color="red" position="0 -1 -5" rotation="0 45 45" scale="1 1 1"
animation__position="property: object3D.position.y; to: 0; dir: alternate; dur: 2000; loop: true"
animation__mouseenter="property: scale; to: 1.2 1.2 1.2; dur: 300; startEvents: mouseenter"
animation__mouseleave="property: scale; to: 1 1 1; dur: 300; startEvents: mouseleave" scale-on-mouseenter>
</a-box>
<a-sound src="hsttps://cdn.aframe.io/basic-guide/audio/backgroundnoise.wav" autoplay="true" position="-3 1 -4">
</a-sound>
<a-entity text="value: Hello, A-Frame!; color: #BBB" position="3.5 3 -5" scale="10 10 10"></a-entity>
<a-camera>
<a-cursor></a-cursor>
</a-camera>
</a-scene>
<script>
AFRAME.registerComponent('scale-on-mouseenter', {
schema: {
to: { default: '2.5 2.5 2.5', type: 'vec3' }
},
init: function () {
var data = this.data;
var el = this.el;
this.el.addEventListener('mouseenter', function () {
el.object3D.scale.copy(data.to);
});
}
});
</script>
</body>
</html>