jumping mode
This commit is contained in:
parent
4038f1667c
commit
564f78c2c6
|
@ -9,6 +9,7 @@ var decay = Math.pow(0.8, 1/timeStep);
|
|||
var stepSize = 50*timeStep;
|
||||
var frameDuration = 40;
|
||||
var radius = 1.4;
|
||||
var jump = false;
|
||||
|
||||
var interval;
|
||||
var time2index = [];
|
||||
|
@ -38,6 +39,7 @@ function init() {
|
|||
var node = $('<span class="button">T'+d+' '+h+':00</span>');
|
||||
node.click(function () {
|
||||
currentTime = time;
|
||||
jump = true;
|
||||
start();
|
||||
})
|
||||
menu.append(node);
|
||||
|
@ -147,13 +149,20 @@ function updateData() {
|
|||
}
|
||||
|
||||
function updatePosition() {
|
||||
if (jump) {
|
||||
clients.forEach(function (client) {
|
||||
client.x = client.xo = client.x0;
|
||||
client.y = client.yo = client.y0;
|
||||
client.r = client.r0;
|
||||
});
|
||||
} else {
|
||||
clients.forEach(function (client) {
|
||||
client.xo = client.x;
|
||||
client.yo = client.y;
|
||||
|
||||
var dx = (client.x0 - client.x);
|
||||
var dy = (client.y0 - client.y);
|
||||
var r = Math.sqrt(dx*dx + dy+dy);
|
||||
var r = Math.sqrt(dx*dx + dy*dy);
|
||||
if (r > 1e-2) {
|
||||
var rn = Math.max(r-stepSize, 0);
|
||||
var f = 1-rn/r;
|
||||
|
@ -165,7 +174,9 @@ function updatePosition() {
|
|||
client.y = client.y0;
|
||||
}
|
||||
client.r += (client.r0 - client.r)*decay;
|
||||
})
|
||||
});
|
||||
}
|
||||
jump = false;
|
||||
}
|
||||
|
||||
function renderCanvas() {
|
||||
|
|
Loading…
Reference in New Issue