This repository has been archived by the owner on Feb 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
64 lines (55 loc) · 1.82 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
obj-viewer {
width: 500px;
height: 350px;
margin: 1rem;
}
</style>
</head>
<body>
<h1><obj-viewer></h1>
<section>
<h2>Default</h2>
<obj-viewer obj-source="https://threejs.org/examples/models/obj/female02/female02.obj"
mtl-source="https://threejs.org/examples/models/obj/female02/female02.mtl"></obj-viewer>
<pre><code></code></pre>
</section>
<section>
<h2>With grid</h2>
<obj-viewer obj-source="https://threejs.org/examples/models/obj/female02/female02.obj"
mtl-source="https://threejs.org/examples/models/obj/female02/female02.mtl" display-grid></obj-viewer>
<pre><code></code></pre>
</section>
<section>
<h2>Without mtl-source</h2>
<obj-viewer obj-source="https://threejs.org/examples/models/obj/female02/female02.obj"></obj-viewer>
<pre><code></code></pre>
</section>
<section>
<h2>Another model</h2>
<obj-viewer obj-source="models/lowpoly-tree.obj" mtl-source="models/lowpoly-tree.mtl"></obj-viewer>
<pre><code></code></pre>
</section>
<!--<section>
<h2>Another model (no mtl-source)</h2>
<obj-viewer obj-source="tree.obj"></obj-viewer>
<pre><code></code></pre>
</section>-->
<script src="https://unpkg.com/obj-viewer/index.js?module" type="module"></script>
<script>
const preElements = [...document.querySelectorAll('pre')];
preElements.forEach(preElement => {
const objViewer = preElement.parentElement.children[1];
preElement.querySelector('code').innerText = objViewer.outerHTML;
});
</script>
</body>
</html>