forked from stemkoski/A-Frame-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
art-gallery.html
125 lines (97 loc) · 3.97 KB
/
art-gallery.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html>
<head>
<title>VR Art Gallery</title>
<meta name="description" content="A-Frame Examples">
<script src="js/aframe-master.1.0.4.min.js"></script>
<script src="js/aframe-environment-component.min.js"></script>
<script src="js/extended-wasd-controls.js"></script>
</head>
<body>
<script>
AFRAME.registerComponent("boundary",
{
init: function()
{
},
tick: function(time, deltaTime)
{
if (this.el.object3D.position.z < -2.5)
this.el.object3D.position.z = -2.5;
if (this.el.object3D.position.z > 2.5)
this.el.object3D.position.z = 2.5;
if (this.el.object3D.position.x < -2.5)
this.el.object3D.position.x = -2.5;
if (this.el.object3D.position.x > 2.5)
this.el.object3D.position.x = 2.5;
}
});
</script>
<!--
disable press "F" to enter fullscreen mode.
-->
<a-scene environment="preset: default; lighting: none;"
keyboard-shortcuts="enterVR: false;">
<!-- Dim ambient lighting. -->
<a-light type="ambient" color="#222222"></a-light>
<a-light type="point" color="#CCCCCC" position="0 3 0"></a-light>
<a-assets timeout="10000">
<img id="crate" src="images/crate.jpg" />
<img id="grid" src="images/color-grid.png" />
<img id="wood" src="images/wood.jpg" />
<img id="plaster" src="images/plaster.jpg" />
<img id="puppy" src="images/photos/puppy.jpg" />
<img id="campfire" src="images/photos/campfire.jpg" />
<img id="bubbles" src="images/photos/bubbles.jpg" />
<img id="lilac" src="images/photos/lilac.jpg" />
<a-asset-item id="table" src="models/table.glb"></a-asset-item>
<a-asset-item id="picture" src="models/picture.glb"></a-asset-item>
<a-asset-item id="pagoda" src="models/pagoda.glb"></a-asset-item>
<!-- <video id="video" loop="true" src="video/sintel.mp4"></video> -->
</a-assets>
<!--
create a camera entity
-->
<a-entity id="camera" camera
position="0 1.6 0"
look-controls wasd-controls="acceleration: 4;" boundary>
</a-entity>
<!-- floor -->
<a-box width="6.5" depth="6.5" height="0.1" position="0 0 0" material="src:#wood;"></a-box>
<!-- walls -->
<a-box width="6.5" depth="0.1" height="3" position="0 1.5 -3.1" material="src:#plaster; repeat: 4.2 2;"></a-box>
<a-box width="6.5" depth="0.1" height="3" position="0 1.5 3.1" material="src:#plaster; repeat: 4.2 2;"></a-box>
<a-box width="6.5" depth="0.1" height="3" position="3.1 1.5 0" rotation="0 90 0" material="src:#plaster; repeat: 4.2 2;"></a-box>
<a-box width="6.5" depth="0.1" height="3" position="-3.1 1.5 0" rotation="0 90 0" material="src:#plaster; repeat: 4.2 2;"></a-box>
<!-- artwork -->
<a-entity position="0 1.2 -3" rotation="0 270 0" scale="1 1 1" gltf-model="#picture">
<a-plane position="0.02 0.68 0" rotation="0 90 0" material="shader:flat; src:#puppy; side:double;"></a-plane>
</a-entity>
<!-- To fix. See:
https://github.com/aframevr/aframe/issues/3647
https://stackoverflow.com/questions/57542229/autoplaying-videosphere-from-a-frame-is-not-working-on-any-browsersafari-chrome
Trigger when user moves close to plane?
<a-video
id = "video-display"
width="1.77" height="1"
position="0 2 -2"
src="#video">
</a-video>
-->
<a-entity position="3 1.2 0" rotation="0 180 0" scale="1 1 1.6" gltf-model="#picture">
<a-plane position="0.02 0.68 0" rotation="0 90 0" material="shader:flat; src:#campfire; side:double;"></a-plane>
</a-entity>
<a-entity position="-3 1.2 0" rotation="0 0 0" scale="1 1 1" gltf-model="#picture">
<a-plane position="0.02 0.68 0" rotation="0 90 0" material="shader:flat; src:#bubbles; side:double;"></a-plane>
</a-entity>
<a-entity position="0 1.2 3" rotation="0 90 0" scale="1 1 1.33" gltf-model="#picture">
<a-plane position="0.02 0.68 0" rotation="0 90 0" material="shader:flat; src:#lilac; side:double;"></a-plane>
</a-entity>
<!-- table display -->
<a-entity position="-2.5 0 -2.5" color="#0000FF" gltf-model="#table">
</a-entity>
<a-entity position="-2.5 0.9 -2.5" scale="0.1 0.1 0.1" color="#0000FF" gltf-model="#pagoda">
</a-entity>
</a-scene>
</body>
</html>