-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvr.html
More file actions
96 lines (84 loc) · 2.57 KB
/
Copy pathvr.html
File metadata and controls
96 lines (84 loc) · 2.57 KB
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
<!DOCTYPE html>
<html>
<head>
<title>VR | SkillUp</title>
<script src="libs/aframe-1.2.0.min.js"></script>
<script src="libs/aframe-ar.js"></script>
<link rel="icon" type="image/png" href="assets/img/ICON.png">
<style>
body {
margin: 0;
overflow: hidden;
height: 100vh;
}
#enter-vr {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0);
color: #fff;
border: none;
padding: 0;
font-size: 24px;
cursor: pointer;
border-radius: 0;
z-index: 1000;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
/* Mobile styles */
@media (max-width: 600px) {
#enter-vr span {
display: inline-block;
transform: rotate(90deg);
transform-origin: center;
}
}
</style>
</head>
<body>
<button id="enter-vr"><span>Enter VR</span></button>
<a-scene embedded antialias="false" stats="false" vr-mode-ui="enabled: false">
<!-- Video with Sound (hidden) -->
<a-video id="background-sound" src="assets/videos/section-trailer.mp4" autoplay="true" loop="false" position="-0.5 6 -9"
scale="12.5 7" playsinline></a-video>
<a-sky src="assets/img/milky-way-4k.png"></a-sky>
<!-- GLB Model -->
<a-entity gltf-model="assets/models/theater.glb" scale="1 1 1" rotation="0 180 0" position="-0.5 1.5 -2.5"></a-entity>
<!-- Camera -->
<a-entity camera position="0 1.6 0"></a-entity>
</a-scene>
<script>
// Custom VR button functionality
const enterVRButton = document.getElementById('enter-vr');
enterVRButton.addEventListener('click', () => {
document.querySelector('a-scene').enterVR();
});
// Attempt to enter VR mode programmatically
window.addEventListener('load', () => {
const scene = document.querySelector('a-scene');
scene.addEventListener('loaded', () => {
scene.enterVR();
});
});
// Click-to-move feature
document.querySelectorAll('[clickable]').forEach(element => {
element.addEventListener('click', (event) => {
const camera = document.querySelector('a-entity[camera]');
const targetPosition = event.target.getAttribute('position');
// Animate movement of the camera to the target position
camera.setAttribute('animation', {
property: 'position',
to: `${targetPosition.x} 1.6 ${targetPosition.z}`,
dur: 1000,
easing: 'easeInOutQuad'
});
});
});
</script>
</body>
</html>