UNPKG

tin-engine

Version:

Simple game engine to make small canvas based games using es6

14 lines (11 loc) 362 B
import TransitionScene from './../lib/transition.js'; export default class CrossfadeTransition extends TransitionScene { constructor(toScene, duration, easing) { super(toScene, duration, easing); } performTransition(ctx) { ctx.drawImage(this.fromBuffer.buffer, 0, 0); ctx.globalAlpha = this.progress; ctx.drawImage(this.toBuffer.buffer, 0, 0); } }