-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (29 loc) · 1.19 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
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><link rel="icon" href="data:">
<title>XR山座熊川</title>
<script type="module">
import * as eg from "https://js.sabae.cc/egvr.js";
eg.model("./sanzakumagawa.glb", 0, 1.3, -1, 0, .5);
eg.text("山座熊川", 0, 1.6, -1.5, .5, "#aaaaaa");
const bgurl1 = "https://code4fukui.github.io/vr-fukui/img/vr-kumagawa-1.jpg";
const bgurl2 = "https://code4fukui.github.io/vr-fukui/img/vr-kumagawa-2.jpg";
const bg = eg.sky(bgurl2);
//bg.setAttribute("rotation", { x: 0, y: -130, z: 0 }); // for bgurl1
bg.setAttribute("rotation", { x: 0, y: -80, z: 0 }); // for bgurl2
const defbg = true;
bg.setAttribute("visible", defbg);
//setInterval(() => console.log(eg.scene.is("ar-mode")), 1000);
eg.scene.addEventListener("enter-vr", function () {
if (eg.scene.is("ar-mode")) {
console.log("Entered AR mode");
bg.setAttribute("visible", false);
} else {
console.log("Entered VR mode");
bg.setAttribute("visible", true);
}
});
eg.scene.addEventListener("exit-vr", function () {
console.log("Exited VR/AR mode");
bg.setAttribute("visible", defbg);
});
eg.model("./kiji.glb", 0, 0, -.3, 0, 1);
</script>