Engine.ScreenTransition = class
{
	constructor()
	{
		this.from = null;
		this.to = null;
		this.screenTransTweenA = null;
		this.screenTransTweenB = null;
	}

	init(from /*Drawable*/, to /*Drawable*/)
	{
		this.from = from;
		this.to = to;
	}

	resetTransition()
	{
		this.from.alpha = 1;
		this.from.x = 0;
		this.from.y = 0;
		this.from.scale.x = 1;
		this.from.scale.y = 1;
		
		this.to.alpha = 1;
		this.to.x = 0;
		this.to.y = 0;
		this.to.scale.x = 1;
		this.to.scale.y = 1;
	}

	transitionOut(transitionComplete /*Action*/)
	{
		
		var scale = 1;// / EngineSettings.Default2DCamera.scale;
		this.resetTransition();
		this.screenTransTweenA = new Engine.SimpleTween((v) => { this.from.x = v; }, Engine.SimpleTween.quadEaseOut, 0, EngineSettings.screenWidth * scale, 0.5, true);
		this.screenTransTweenA.onFinish = transitionComplete;
		this.screenTransTweenB = new Engine.SimpleTween((v) => { this.to.x = v; }, Engine.SimpleTween.quadEaseOut, -EngineSettings.screenWidth * scale, 0, 0.5, true);
		
		this.from.x = 0;
		this.to.x = -EngineSettings.screenWidth * scale;
	}

	transitionIn(transitionComplete /*Action*/)
	{
		var scale = 1;// / EngineSettings.Default2DCamera.scale;
		this.resetTransition();
		this.screenTransTweenA = new Engine.SimpleTween((v) => { this.to.x = v; }, Engine.SimpleTween.quadEaseOut, EngineSettings.screenWidth * scale, 0, 0.5, true);
		this.screenTransTweenA.onFinish = transitionComplete; 
		this.screenTransTweenB = new Engine.SimpleTween((v) => { this.from.x = v; }, Engine.SimpleTween.quadEaseOut, 0, -EngineSettings.screenWidth * scale, 0.5, true);
		
		this.from.x = EngineSettings.screenWidth * scale;
		this.to.x = 0;
		
	}
	
}