-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
27 lines (24 loc) · 920 Bytes
/
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
; /* This woven web of lies. (C) 2012 David Byard. Released under AGPLv3. See LICENSE. */ ;
namespace = window.namespace || {};
/* Main loop */
window.addEventListener('load', function() {
var width = 64;
var height = 64;
var canvas = document.getElementById('woven-web');
var param = 'Knowledge';
var paramIndex = window.location.href.indexOf('?word=');
if (paramIndex != -1) {
var potentialParam = window.location.href.substring(paramIndex + 6, window.location.length);
if (potentialParam != '') {
param = decodeURIComponent(potentialParam.replace('+', ' '));
}
}
var controller = new namespace.Controller(param, new Date());
var renderer = new namespace.Renderer(canvas);
function loop() {
var view = controller.tick(new Date());
renderer.render(view);
window.setTimeout(loop, 50);
}
loop();
});