-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
86 lines (82 loc) · 1.87 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
<!DOCTYPE html>
<html>
<head>
<title>3D Model Artificial Reality</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Import the component -->
<script
type="module"
src="https://unpkg.com/@google/model-viewer/dist/model-viewer.js"
></script>
<script
nomodule
src="https://unpkg.com/@google/model-viewer/dist/model-viewer-legacy.js"
></script>
<style>
* {
margin: 0;
padding: 0;
}
.demo {
height: 100vh;
width: 100%;
}
.demo model-viewer{
width: 100%;
height: 100%;
}
.btn-container{
position: absolute;
bottom: 50px;
width: 100%;
text-align:center;
}
button{
border: none;
background: #edda73;
height: 40px;
width: 150px;
margin: 5px 15px;
cursor: pointer;
font-weight: bold;
font-size:16px;
}
button:focus{
outline: none;
}
</style>
</head>
<body>
<!-- Use it like any other HTML element -->
<div class="demo">
<model-viewer
id="model"
src="RobotExpressive.glb"
alt="RobotExpressive"
auto-rotate
camera-controls
skybox-image="stadium_01_2k.hdr"
animation-name="Running"
autoplay
ar
></model-viewer>
<div class="btn-container">
<button type="button" onclick="stop()">STOP</button>
<button type="button" onclick="run()">RUN</button>
<button type="button" onclick="wave()">WAVE</button>
</div>
</div>
<script type="text/javascript">
var modelViewer = document.getElementById('model');
function stop() {
modelViewer.animationName = 'none';
}
function run() {
modelViewer.animationName = 'Running';
}
function wave() {
modelViewer.animationName = 'Wave';
}
</script>
</body>
</html>