Update SCript
This commit is contained in:
parent
38e389606a
commit
0a1a4957f1
|
|
@ -12,7 +12,9 @@
|
||||||
<a-box id="second-box-as-comparison" position="0 0 0" material="opacity: 0"></a-box>
|
<a-box id="second-box-as-comparison" position="0 0 0" material="opacity: 0"></a-box>
|
||||||
|
|
||||||
</a-marker>
|
</a-marker>
|
||||||
<a-entity id="smoothed-box" position="0 0 0" scale="2 2 2" gltf-model="cup_of_cappuccino/scene.gltf"></a-entity>
|
<a-entity id="smoothed-box" position="0 0 0" scale="5 5 5">
|
||||||
|
<a-entity rotation="0 0 0" gltf-model="cup_of_cappuccino/scene.gltf" rotation-limiter ></a-entity>
|
||||||
|
</a-entity>
|
||||||
<a-entity camera></a-entity>
|
<a-entity camera></a-entity>
|
||||||
|
|
||||||
</a-scene>
|
</a-scene>
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,27 @@
|
||||||
<script src="smooth_script.js"></script>
|
<script src="smooth_script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body id="gamed" style="margin: 0px; overflow: hidden">
|
<body id="gamed" style="margin: 0px; overflow: hidden">
|
||||||
<a-scene embedded arjs='patternRatio:0.8;'>
|
<a-scene embedded arjs="patternRatio:0.8;">
|
||||||
|
<a-marker
|
||||||
<a-marker lerpsmooth id="marker" type="pattern" url="pattern-WebAR_QR.patt">
|
lerpsmooth
|
||||||
<a-box id="second-box-as-comparison" position="0 0 0" material="opacity: 0"></a-box>
|
id="marker"
|
||||||
|
type="pattern"
|
||||||
|
url="pattern-WebAR_QR.patt"
|
||||||
|
>
|
||||||
|
<a-box
|
||||||
|
id="second-box-as-comparison"
|
||||||
|
position="0 0 0"
|
||||||
|
material="opacity: 0"
|
||||||
|
></a-box>
|
||||||
</a-marker>
|
</a-marker>
|
||||||
<a-entity id="smoothed-box" position="0 0 0" scale="5 5 5" gltf-model="cup_of_cappuccino/scene.gltf"></a-entity>
|
<a-entity id="smoothed-box" position="0 0 0" scale="5 5 5">
|
||||||
|
<a-entity
|
||||||
|
rotation="0 0 0"
|
||||||
|
gltf-model="cup_of_cappuccino/scene.gltf"
|
||||||
|
rotation-limiter
|
||||||
|
></a-entity>
|
||||||
|
</a-entity>
|
||||||
<a-entity camera></a-entity>
|
<a-entity camera></a-entity>
|
||||||
|
|
||||||
</a-scene>
|
</a-scene>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -6,15 +6,27 @@
|
||||||
<script src="smooth_script.js"></script>
|
<script src="smooth_script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body id="gamed" style="margin: 0px; overflow: hidden">
|
<body id="gamed" style="margin: 0px; overflow: hidden">
|
||||||
<a-scene embedded arjs='patternRatio:0.8;'>
|
<a-scene embedded arjs="patternRatio:0.8;">
|
||||||
|
<a-marker
|
||||||
<a-marker lerpsmooth id="marker" type="pattern" url="pattern-WebAR_QR.patt">
|
lerpsmooth
|
||||||
<a-box id="second-box-as-comparison" position="0 0 0" material="opacity: 0"></a-box>
|
id="marker"
|
||||||
|
type="pattern"
|
||||||
|
url="pattern-WebAR_QR.patt"
|
||||||
|
>
|
||||||
|
<a-box
|
||||||
|
id="second-box-as-comparison"
|
||||||
|
position="0 0 0"
|
||||||
|
material="opacity: 0"
|
||||||
|
></a-box>
|
||||||
</a-marker>
|
</a-marker>
|
||||||
<a-entity id="smoothed-box" position="0 0 0" scale="8 8 8" gltf-model="cup_of_cappuccino/scene.gltf"></a-entity>
|
<a-entity id="smoothed-box" position="0 0 0" scale="5 5 5">
|
||||||
|
<a-entity
|
||||||
|
rotation="0 0 0"
|
||||||
|
gltf-model="cup_of_cappuccino/scene.gltf"
|
||||||
|
rotation-limiter
|
||||||
|
></a-entity>
|
||||||
|
</a-entity>
|
||||||
<a-entity camera></a-entity>
|
<a-entity camera></a-entity>
|
||||||
|
|
||||||
</a-scene>
|
</a-scene>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
31
index.html
31
index.html
|
|
@ -1,12 +1,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="UTF-8" />
|
||||||
<meta charset="UTF-8">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>AR Menu</title>
|
<title>AR Menu</title>
|
||||||
<!-- <link rel="stylesheet" href="assets/style/style.css"> </link> -->
|
<!-- <link rel="stylesheet" href="assets/style/style.css"> </link> -->
|
||||||
<style>html,
|
<style>
|
||||||
|
html,
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|
@ -47,22 +47,27 @@
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
border: none;
|
border: none;
|
||||||
display: none;
|
display: none;
|
||||||
}</style>
|
}
|
||||||
|
</style>
|
||||||
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
|
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
|
||||||
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.min.js"></script>
|
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="iframe-container">
|
<div id="iframe-container">
|
||||||
<button id="button" onclick="closeSelf()" style="background-color: aqua; z-index: 3;">Go Back</button>
|
<button
|
||||||
|
id="button"
|
||||||
|
onclick="closeSelf()"
|
||||||
|
style="background-color: aqua; z-index: 3"
|
||||||
|
>
|
||||||
|
Go Back
|
||||||
|
</button>
|
||||||
<iframe id="ar-frame" src="" width="300" height="200"></iframe>
|
<iframe id="ar-frame" src="" width="300" height="200"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
<!-- Menu items will be inserted here -->
|
<!-- Menu items will be inserted here -->
|
||||||
</div>
|
</div>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
|
<script src="rotation_limit.js"></script>
|
||||||
|
</body>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
AFRAME.registerComponent('rotation-limiter', {
|
||||||
|
tick: function () {
|
||||||
|
var el = this.el;
|
||||||
|
var rotation = el.getAttribute('rotation');
|
||||||
|
|
||||||
|
rotation.x = Math.max(0, Math.min(90, rotation.x));
|
||||||
|
rotation.y = Math.max(0, Math.min(90, rotation.y));
|
||||||
|
rotation.z = Math.max(0, Math.min(90, rotation.z));
|
||||||
|
|
||||||
|
el.setAttribute('rotation', rotation);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue