forked from satoshi-katayama/ajimi-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (22 loc) · 798 Bytes
/
index.js
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
window.onload = function () {
// document.querySelector('.add').addEventListener('click', clickHandler, false);
document.querySelector('.araburi').addEventListener('click', araburiHandler, false);
};
function clickHandler(e) {
var img = document.createElement('a-collada-model');
img.setAttribute('position', getRand() + ' 0 -10');
img.setAttribute('src', '#limited4');
img.setAttribute('rotation', '0 0 0');
img.setAttribute('scale', '0.1 0.1 0.1');
img.addEventListener('click', clickHandler, false);
var scene = document.querySelector('a-scene');
scene.appendChild(img);
}
function araburiHandler(e) {
document.querySelector('#income').emit('bigger');
}
function getRand() {
var max = 20;
var min = -20;
return ( Math.random() * ( ( max + 1 ) - min ) ) + min;
}