Added default time in Camera.js

This commit is contained in:
Thomas FORGIONE 2015-06-15 08:46:35 +02:00
parent be99ba00e6
commit 638111c3b1
1 changed files with 3 additions and 0 deletions

View File

@ -13,6 +13,9 @@ Camera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
// Update function // Update function
Camera.prototype.update = function(time) { Camera.prototype.update = function(time) {
if (time === undefined) {
time = 20;
}
this.theta += 0.01 * time / 20; this.theta += 0.01 * time / 20;
this.position.x = Camera.DISTANCE_X*Math.cos(this.theta); this.position.x = Camera.DISTANCE_X*Math.cos(this.theta);
this.position.y = Camera.DISTANCE_X*Math.sin(this.theta); this.position.y = Camera.DISTANCE_X*Math.sin(this.theta);