-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
79 lines (75 loc) · 2.6 KB
/
index.html
File metadata and controls
79 lines (75 loc) · 2.6 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AR Food Menu</title>
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.menu-item {
border: 1px solid #ddd;
padding: 20px;
margin-bottom: 20px;
border-radius: 5px;
}
model-viewer {
width: 100%;
height: 200px;
background-color: #f0f0f0;
}
</style>
</head>
<body>
<h1>AR Food Menu</h1>
<div id="menu-container">
<!-- Menu items will be dynamically inserted here -->
</div>
<script>
const menuItems = [
{
name: "Cheeseburger",
description: "Delicious beef patty with melted cheese, lettuce, and tomato.",
thumbnail: "thumb.webp",
glbModel: "scene.glb",
usdzModel: "pi.usdz"
},
{
name: "Pizza Margherita",
description: "Classic pizza with tomato sauce, mozzarella, and basil.",
thumbnail: "pizza-thumbnail.jpg",
glbModel: "pizza.glb",
usdzModel: "pizza.usdz"
}
// Add more menu items as needed
];
function createMenuItemHTML(item) {
return `
<div class="menu-item">
<h2>${item.name}</h2>
<p>${item.description}</p>
<model-viewer src="${item.glbModel}"
ios-src="${item.usdzModel}"
alt="${item.name} 3D model"
ar ar-modes="webxr scene-viewer quick-look"
camera-controls
poster="${item.thumbnail}">
<button slot="ar-button" style="background-color: white; border-radius: 4px; border: none; position: absolute; bottom: 16px; right: 16px; ">
👀 View in AR
</button>
</model-viewer>
</div>
`;
}
const menuContainer = document.getElementById('menu-container');
menuItems.forEach(item => {
menuContainer.innerHTML += createMenuItemHTML(item);
});
</script>
</body>
</html>