UNPKG

tin-engine

Version:

Simple game engine to make small canvas based games using es6

14 lines (11 loc) 398 B
import TransitionScene from '../lib/transition.js'; export default class SlideInLeftTransition 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); } }