This commit is contained in:
Thomas FORGIONE 2015-05-21 16:59:17 +02:00
parent ce4eee3c44
commit 7e52e1ec08
3 changed files with 22 additions and 8 deletions

View File

@ -9,11 +9,12 @@ BD.Private.sendData = function(url, data) {
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/json;charset=UTF-8"); xhr.setRequestHeader("Content-type", "application/json;charset=UTF-8");
xhr.onreadystatechange = function() { // xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) { // if(xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText); // console.log(xhr.responseText);
} // }
} // }
xhr.send(JSON.stringify(data)); xhr.send(JSON.stringify(data));
} }

View File

@ -92,7 +92,7 @@ PointerCamera.prototype.hermiteMotion = function(time) {
this.target = Tools.sum(this.position, this.hermiteAngles.eval(this.t)); this.target = Tools.sum(this.position, this.hermiteAngles.eval(this.t));
this.t += 0.01 * time / 20; this.t += 0.01 * time / 20;
fayt
if (this.t > 1) { if (this.t > 1) {
this.movingHermite = false; this.movingHermite = false;
this.anglesFromVectors(); this.anglesFromVectors();

View File

@ -44,7 +44,7 @@ ReplayCamera.prototype.look = function() {
ReplayCamera.prototype.update = function(time) { ReplayCamera.prototype.update = function(time) {
if (this.started) { if (this.started) {
if (this.event.type == 'camera') { if (this.event.type == 'camera') {
this.linearMotion(time); this.cameraMotion(time);
} else if (this.event.type == 'previousnext') { } else if (this.event.type == 'previousnext') {
this.linearMotion(time / 5); this.linearMotion(time / 5);
} else if (this.event.type == 'arrow') { } else if (this.event.type == 'arrow') {
@ -62,7 +62,6 @@ ReplayCamera.prototype.linearMotion = function(time) {
this.position.x = tmp.x; this.position.x = tmp.x;
this.position.y = tmp.y; this.position.y = tmp.y;
this.position.z = tmp.z; this.position.z = tmp.z;
this.target = Tools.sum(Tools.mul(this.old_target, 1-this.t), Tools.mul(this.new_target, this.t));
this.t += 0.1 * time / 20; this.t += 0.1 * time / 20;
if (this.t > 1) { if (this.t > 1) {
@ -70,6 +69,20 @@ ReplayCamera.prototype.linearMotion = function(time) {
} }
} }
ReplayCamera.prototype.cameraMotion = function(time) {
var tmp = Tools.sum(Tools.mul(this.old_position, 1-this.t), Tools.mul(this.new_position, this.t));
this.position.x = tmp.x;
this.position.y = tmp.y;
this.position.z = tmp.z;
this.target = Tools.sum(Tools.mul(this.old_target, 1-this.t), Tools.mul(this.new_target, this.t));
this.t += 1 / (((new Date(this.path[this.counter].time)).getTime() - (new Date(this.path[this.counter-1].time)).getTime()) / 20);
if (this.t > 1) {
this.nextEvent();
}
}
ReplayCamera.prototype.hermiteMotion = function(time) { ReplayCamera.prototype.hermiteMotion = function(time) {
var eval = this.hermitePosition.eval(this.t); var eval = this.hermitePosition.eval(this.t);
this.position.x = eval.x; this.position.x = eval.x;