-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
29 lines (20 loc) · 1.01 KB
/
main.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
27
28
29
define(function(require, module, exports) {
document.body.setAttribute("oncontextmenu", "return false;");
window.div = document.getElementById("div");
window.Quaternion = require("Quaternion");
document.onmousemove = function(event) {
//event.preventDefault();
var button = event.which || event.button;
if (button === 0) {
return false;
}
else if (button === 1) {
div.style.webkitTransform = "matrix3d("+new Quaternion(0,0,0,0).rotateWXYZ((event.clientX/window.innerWidth)*2*Math.PI, new Quaternion(0,0,1,0))+")";
}
else if (button === 2) {
div.style.webkitTransform = "matrix3d("+new Quaternion(0,0,0,0).rotateWXYZ((event.clientX/window.innerWidth)*2*Math.PI, new Quaternion(0,1,0,0))+")";
} else if (button === 3) {
div.style.webkitTransform = "matrix3d("+new Quaternion(0,0,0,0).rotateWXYZ((event.clientX/window.innerWidth)*2*Math.PI, new Quaternion(0,0,0,1))+")";
}
}
});