@curiousmedia/createjs-scene-container
Version:
A scene manager for CreateJS
47 lines (39 loc) • 1.03 kB
JavaScript
import SceneTransition from "./SceneTransition";
export default class DefaultSceneTransition extends SceneTransition
{
constructor( name, options, color = "#000" )
{
super( name, options );
// TODO: Reference app settings
const width = 1664;
const height = 768;
this.regX = width / 2;
this.regY = height / 2;
this.overlay = new createjs.Shape();
this.overlay.graphics.f( color ).dr( 0, 0, width, height );
this.overlay.set( { alpha: 0, visible: false } );
this.addChild( this.overlay );
}
animateIn()
{
// console.log("Animating in....", this.name);
return new Promise( resolve =>
{
createjs.Tween.get( this.overlay )
.set( { visible: true } )
.to( { alpha: 1 }, 250, createjs.Ease.quadInOut )
.call( resolve );
} );
}
animateOut()
{
// console.log("Animating in....", this.name);
return new Promise( resolve =>
{
createjs.Tween.get( this.overlay )
.to( { alpha: 0 }, 250, createjs.Ease.quadInOut )
.set( { visible: false } )
.call( resolve );
} );
}
}