tin-engine
Version:
Simple game engine to make small canvas based games using es6
14 lines (11 loc) • 401 B
JavaScript
import TransitionScene from './../lib/transition.js';
export default class SlideInRightTransition extends TransitionScene {
constructor(toScene, duration, easing) {
super(toScene, duration, easing);
}
performTransition(ctx) {
const offset = this.progress * this.size.x;
ctx.drawImage(this.fromBuffer.buffer, offset, 0);
ctx.drawImage(this.toBuffer.buffer, -this.size.x + offset, 0);
}
}