30 lines
807 B
JavaScript
30 lines
807 B
JavaScript
var SPEED = 3.0;
|
|
var DURATION = 2.0;
|
|
|
|
function MoveCubeCutscene(params) {
|
|
Cutscene.call(this);
|
|
this.cube = params.cube;
|
|
|
|
var startX = this.cube.position.position.x;
|
|
|
|
this.anim = new Animation([
|
|
[
|
|
{ time: 0.0, value: startX, easing: Easing.outQuad },
|
|
{ time: DURATION, value: startX - SPEED * DURATION, easing: Easing.inOutQuad },
|
|
{ time: DURATION * 2, value: startX }
|
|
]
|
|
]);
|
|
|
|
this.anim.onComplete = function() { Cutscene.finish(); };
|
|
}
|
|
|
|
MoveCubeCutscene.prototype = Object.create(Cutscene.prototype);
|
|
MoveCubeCutscene.prototype.constructor = MoveCubeCutscene;
|
|
|
|
MoveCubeCutscene.prototype.update = function() {
|
|
this.anim.update(TIME.delta);
|
|
this.cube.position.position.x = this.anim.properties[0].value;
|
|
};
|
|
|
|
module = MoveCubeCutscene;
|