adding start, min and max time

This commit is contained in:
Micho 2013-05-21 11:25:06 +02:00
parent 493adb893b
commit 61bc8b175f
1 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,9 @@
var currentTime = 60*(24*1+10); var startTime = (24*1 + 9)*60;
var minTime = (24*0 + 12)*60;
var maxTime = (24*4 + 22)*60;
var currentTime = startTime;
var clients = []; var clients = [];
var context; var context;
var width = 980; var width = 980;
@ -27,7 +32,7 @@ for (var x = -nearFieldGridRadius; x < width/gridSize+nearFieldGridRadius; x++)
$(function () { $(function () {
init(); init();
start(); start();
setTimeout(stop, 10000); //setTimeout(stop, 60000);
}) })
function init() { function init() {
@ -85,9 +90,13 @@ function stop() {
function update() { function update() {
currentTime += timeStep; currentTime += timeStep;
if (currentTime >= 4*24*60) { if (currentTime > maxTime) {
currentTime = maxTime;
stop(); stop();
return; }
if (currentTime < minTime) {
currentTime = minTime;
} }
renderTime(); renderTime();