forked from nexus-js/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (37 loc) · 1.25 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var manager = require('./lib/core/manager');
var domUtils = require('./lib/utils/dom');
var drawingUtils = require('./lib/utils/drawing');
var mathUtils = require('./lib/utils/math');
var extend = require('extend');
var WebFont = require('webfontloader');
/************************************************
* INSTANTIATE NX MANAGER AND CREATE ELEMENTS *
************************************************/
window.nx = new manager();
window.nx.onload = function() {};
window.nx = extend(window.nx,domUtils)
window.nx = extend(window.nx,drawingUtils)
window.nx = extend(window.nx,mathUtils)
/* this onload function turns canvases into nexus elements,
* using the canvas's id as its var name */
window.onload = function() {
try {
WebFont.load({
google: {
families: ['Open Sans']
}
});
} catch(e) {
console.log("font not loaded")
}
nx.addStylesheet();
// get all canvases on the page and add them to the manager
var allcanvi = document.getElementsByTagName("canvas");
for (i=0;i<allcanvi.length;i++) nx.transform(allcanvi[i]);
if (nx.isTouchDevice) {
document.addEventListener("touchmove", nx.blockMove, true);
document.addEventListener("touchstart", nx.blockMove, true);
}
nx.onload();
nx.startPulse();
};