Files
dusk/assets/cutscenes/MoveCubeCutscene.js
T
2026-05-08 23:11:20 -05:00

31 lines
725 B
JavaScript

function MoveCubeCutscene(params) {
Cutscene.call(this);
this.cube = params.cube;
var SPEED = 3.0;
var DURATION = 2.0;
this.anim = new Animation([
[
{ time: 0.0, value: 0, easing: Easing.inOutQuad },
{ time: DURATION, value: -(SPEED * DURATION), easing: Easing.inOutQuad },
{ time: DURATION * 2, value: 0 }
]
]);
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;