forked from Cecropia/thehallaframe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
227 lines (185 loc) · 7.88 KB
/
index.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mark Hall's Desktop App</title>
</meta>
<link rel="stylesheet" type="text/css" href="my.css">
<script src="js/aframe.0.7.0.min.js"></script>
<script src="js/aframe-extras.min.js"></script>
<script src="js/lzma.js"></script>
<script src="js/ctm.js"></script>
<script src="js/CTMLoader.js"></script>
<script src="js/aframe-teleport-controls.min.js"></script>
<script src="js/spheres_anim.js"></script>
<script src="js/anim_1.js"></script>
<script src="js/anim_2.js"></script>
<script src="js/mocap.js"></script>
<script src="js/envMapMaterial.js"></script>
<script src="js/ctm_component.js"></script>
<script src="js/mobile_component.js"></script>
<script type="text/javascript">
function init() {
}
window.onload = init;
</script>
</head>
<body>
<div id="splash_wraper">
<div class="inner">
<div class="startButton">
<button id="enterTheMatrix" onclick="start()">Start</button>
</div>
<div class="instructions">
<div id="desktop_instructions" style="display:none"><strong>Desktop</strong>: Keyboard (WASD/arrows) and mouse.</div>
<div id="headset_instrucitons" style="display:none"><strong>VR headset</strong>: Hand controllers and teleport with trigger.</div>
<div id="mobile_instructions" style="display:none"><strong>Mobile</strong>: Gaze cursor and teleportation.</div>
</div>
</div>
<div class="footer">
<div class="gradient left"></div>
<div class="gradient right"></div>
<div class="terms">
<a href="https://www.google.com/intl/en/policies/privacy/" target="_blank">Privacy</a> & <a href="https://www.google.com/intl/en/policies/terms/" target="_blank">Terms</a>
</div>
<ul class="credits">
<li><a href="https://webvrexperiments.com/" target="_blank">WebVR</a></li>
<li><a href="http://www.immersus.co/" target="_blank">BioFlightVR</a></li>
</ul>
<div class="headphones">
<img src="img/Headphones_icon_white.png">
<div id="headphones-text">Headphones Recommended</div>
</div>
</div>
</div>
<a-scene id="traumaRoom-ascene" style="display:none">
<a-camera>
<a-entity id="opacity_move" scale="1 1 1" position="0.0 0 -1" text="opacity:0.0;color:black;align:center;value:Use the Arrow Keys to Move;width:1.5">
</a-entity>
<a-entity id="opacity_look" scale="1 1 1" position="0.0 0 -1" text="opacity:1.0;color:black;align:center;value:Click and Drag to look arround;width:1.5">
</a-entity>
</a-camera>
<a-entity mobile></a-entity>
<a-entity light="type: directional; color: #FFF; intensity: 0.5" position="2 20 0"></a-entity>
<a-entity light="type: ambient; color: #FFF"></a-entity>
<a-assets>
<a-mixin id="checkpoint"></a-mixin>
<a-mixin id="checkpoint-hovered" color="#6CEEB5"></a-mixin>
<img id="sky_sphere-texture" src="textures/black_sky_sphere.jpg">
<a-sound id="sound1" src="audio/84529__cmusounddesign__02-museum.ogg"
autoplay="false"
loop="true"
position="1 1 0"
on="start"></a-sound>
<a-sound id="sound2"src="audio/219462__cediez__musee-victoria-londres-grand-escalier.ogg"
autoplay="false"
loop="true"
position="1 1 10"
on="start"></a-sound>
<!-- floor -->
<a-asset-item id="floor-obj" src="models/floor.obj"></a-asset-item>
<img id="floor-texture" src="textures/floor.jpg">
<img id="floor_normal-texture" src="textures/floor_normal.jpg">
<!-- - floor -->
<!-- hall -->
<a-asset-item id="hall-obj" src="models/hall.obj"></a-asset-item>
<img id="hall-texture" src="textures/hall.jpg">
<!--<img id="hall_normal-texture" src="textures/hall_normal.jpg">-->
<!-- - hall -->
<!-- hall low floor -->
<!-- this piece is only meant for teleportation -->
<a-asset-item id="hall_low_floor-obj" src="models/hall_low_floor.obj"></a-asset-item>
<!-- - hall low floor-->
<script id="link" type="text/html">
<a-entity class="link"
geometry="primitive: plane; height: 1; width: 1"
material="shader: flat; src: ${thumb}"
sound="on: click; src: #click-sound"></a-entity>
</script>
<a-asset-item id="catheter" src="models/SuctionCatheter_straight.obj"></a-asset-item>
<!-- Trauma Room -->
<a-asset-item id="TraumaRoom-obj" src="models/TraumaRoom.obj"></a-asset-item>
<a-asset-item id="TraumaRoom-mtl" src="models/TraumaRoom.mtl"></a-asset-item>
<!-- - Trauma Room -->
<a-asset-item id="wolf-gtlf" src="models/wolf.gltf"></a-asset-item>
</a-assets>
<a-sky color="#EEEEFF" material="src: #sky_sphere-texture"></a-sky>
<a-gltf-model src="#wolf"></a-gltf-model>
<a-obj-model src="#TraumaRoom-obj" mtl="#TraumaRoom-mtl"
scale="0.01 0.01 0.01"></a-obj-model>
<a-obj-model src="models/Earth.obj" mtl="models/Earth.mtl"><a-obj-model>
<a-entity teleport-controls="button: trigger; collision-entities: #floor #hall_low_floor" hand-controls="left"></a-entity>
<a-entity teleport-controls="button: trigger; collision-entities: #floor #hall_low_floor" hand-controls="right"></a-entity>
</a-scene>
<div id="exitButton" onClick="window.location.reload()" ><a href="index.html"></a></div>
<script>
var flag = 0;
var done = false;
var element = window;
element.addEventListener("mousedown", function(){
flag = 0;
}, false);
element.addEventListener("mousemove", function(){
flag = 1;
}, false);
element.addEventListener("mouseup", function(){
if(flag === 0){
console.log("click");
}
else if(flag === 1){
console.log("drag");
if(!done){
done = true;
document.getElementById("opacity_look").setAttribute('text','opacity', 0);
document.getElementById("opacity_move").setAttribute('text','opacity', 1);
}
}
}, false);
window.addEventListener("keydown", function (event) {
if (event.defaultPrevented) {
return; // Do nothing if the event was already processed
}
switch (event.key) {
case "ArrowDown":
document.getElementById("opacity_move").setAttribute('text','opacity', 0);
break;
case "ArrowUp":
document.getElementById("opacity_move").setAttribute('text','opacity', 0);
break;
case "ArrowLeft":
document.getElementById("opacity_move").setAttribute('text','opacity', 0);
break;
case "ArrowRight":
document.getElementById("opacity_move").setAttribute('text','opacity', 0);
break;
default:
return; // Quit when this doesn't handle the key event.
}
// Cancel the default action to avoid it being handled twice
event.preventDefault();
}, true);
</script>
</body>
</html>
<script>
function start() {
document.getElementById("splash_wraper").style.display = "none";
document.getElementById("traumaRoom-ascene").style.display = "block";
document.getElementById("desktop_instructions").className = "fadeImage"
document.getElementById("sound1").components.sound.playSound();
document.getElementById("sound2").components.sound.playSound();
document.getElementById("exitButton").className = "visible";
}
function anaimateText(){
var opacity = document.getElementById('opacity');
var obj = {opacity: 0};
var tween = new AFRAME.TWEEN.Tween(obj)
.to({opacity: 1}, 500)
.repeat( Infinity )
.yoyo( true )
.onUpdate(function () {
opacity.setAttribute('text', 'opacity', obj.opacity);
})
.start();
}
</script>