-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode
100 lines (92 loc) · 2.82 KB
/
code
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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AR-WAY</title>
<script>
document.addEventListener("DOMContentLoaded", function () {
const resources = [
{
href: "https://github.com/ZhilinAR/project_AR_furniture/blob/97f79da4d54a14c85bc348207967af0cd75fb9a0/ust_andr7.glb",
as: "fetch",
type: "model/gltf-binary",
},
{
href: "https://your-bucket.s3.amazonaws.com/path-to-poster/photo_2024-07-27_11-15-34.webp",
as: "image",
},
];
resources.forEach((resource) => {
const link = document.createElement("link");
link.rel = "preload";
link.href = resource.href;
link.as = resource.as;
link.type = resource.type;
link.crossOrigin = "anonymous";
document.head.appendChild(link);
});
// Загрузка модели и постера
const Urlk = "https://github.com/ZhilinAR/project_AR_furniture/blob/97f79da4d54a14c85bc348207967af0cd75fb9a0/ust_andr7.glb";
const Urlp = "https://your-bucket.s3.amazonaws.com/path-to-poster/photo_2024-07-27_11-15-34.jpg";
const modelViewer = document.getElementById("dimension-demo");
if (modelViewer) {
modelViewer.setAttribute("src", Urlk);
modelViewer.setAttribute("poster", Urlp);
}
});
</script>
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.js"></script>
<style>
html, body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
margin: 0;
padding: 0;
height: 100vh;
width: 100vw;
overflow: hidden;
font-family: "Petrov Sans-Trial", "Arial", sans-serif;
background-color: #fff;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center center;
}
model-viewer {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
}
@media (max-width: 768px) {
body {
flex-direction: column;
}
model-viewer {
width: 100%;
height: 100%;
}
}
</style>
</head>
<body>
<model-viewer
id="dimension-demo"
ar-modes="webxr"
autoplay=""
ar-scale="fixed"
camera-orbit="-30deg auto auto"
max-camera-orbit="auto 100deg auto"
shadow-intensity="1"
camera-controls
touch-action="pan-y"
crossorigin="anonymous"
tone-mapping="commerce"
alt="A 3D model of an armchair."
>
</model-viewer>
</body>
</html>