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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i));
var is_ipad = (navigator.userAgent.match(/iPad/i));
var is_android = (navigator.userAgent.match(/Android/i))
var is_mobile = is_iphone || is_ipad || is_android;
if (is_mobile) {
// window.location.href = "mobile.html"
$("html").addClass("mobile");
}
else if ($.browser.msie || ! has3d()) {
// window.location.href = "error.html"
}
else {
$("html").addClass("desktop");
}
new WOW().init();
$('.hero .circle').click( function(){
$('.videoModal').addClass('active');
});
$('.videoModal .ion-ios7-close-empty').click( function(){
$('.videoModal').removeClass('active');
});
var scene, cam, map;
var app = new function(){}
app.mode = { editor: false, builder: false }
app.init = function () {
app.tube = new Tube ()
app.router = new SiteRouter ()
}
app.launch = function () {
var movements
scene = new MX.Scene().addTo('#scene')
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
window.onresize = function () {
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
scene.update()
}
cam = scene.camera
cam.y = viewHeight
if (MX.Map) map = app.map = new MX.Map()
if (is_mobile) {
app.movements = new MX.MobileMovements(cam, viewHeight)
}
else {
app.movements = new MX.Movements(cam, viewHeight)
}
app.movements.init()
var last_t = 0
function animate (t) {
var dt = t - last_t
last_t = t
requestAnimationFrame(animate)
environment.update(t)
window.path && path.update(t)
app.movements.update(dt || 0)
scene.update()
}
var loader = new Loader(function(){
$("#loader").hide()
window.environment && window.environment.init()
// window.editor && window.editor.init()
// window.path && window.path.init()
animate()
})
// loader.preloadImages([])
loader.ready()
}
app.on = function(){
app.tube.on.apply(app.tube, arguments)
}
app.off = function(){
app.tube.off.apply(app.tube, arguments)
}
app.position = function(obj){
var pos = {
x: obj.x,
y: obj.y,
z: obj.z,
rotationX: obj.rotationX,
rotationY: obj.rotationY
}
if (obj.scale !== 1) {
pos.scale = obj.scale
}
return pos
}
document.addEventListener('DOMContentLoaded', app.init)
|