forked from Akihiro0710/SHIBUYA-VR-APPEAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
57 lines (55 loc) · 1.69 KB
/
index.php
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>A-Frame で超簡単 AR</title>
</head>
<body>
<!-- A-Frame ライブラリの読み込み -->
<script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
<!-- AR.js ライブラリの読み込み -->
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<!-- A-Frame の VR空間に AR.js を紐づける(デバッグUIは非表示) -->
<a-scene embedded arjs="debugUIEnabled:false;">
<!-- OBJ形式のCGモデルの読み込み -->
<a-assets>
<a-asset-item id="obj" src="assets/java/java.obj"></a-asset-item> <!-- objファイル -->
<a-asset-item id="mtl" src="assets/java/java.mtl"></a-asset-item> <!-- mtlファイル -->
</a-assets>
<!-- マーカーを登録(プリセットされている「hiro」マーカー) -->
<a-marker preset="hiro">
<a-obj-model
src="#obj"
mtl="#mtl"
scale="0.5 0.5 0.5"
position="0 0 0">
<a-animation
attribute="rotation"
to="0 360 0"
dur="3000"
easing="linear"
repeat="indefinite">
</a-animation>
</a-obj-model>
</a-marker>
<!-- AR用のカメラを置く -->
<a-entity camera></a-entity>
</a-scene>
<div id="like_button">
いいね
</div>
</body>
<script>
(function () {
var countHolder = document.createElement('div');
var count = 0;
var button = document.getElementById('like_button');
button.appendChild(countHolder);
button.addEventListener('click', function () {
count++;
countHolder.innerText = count;
})
})();
</script>
</html>