import Phaser from 'phaser'
import CinematicScreen from '../cinematic-screen'

export default class Intro2 extends CinematicScreen {
    constructor(game, parent, name) {
        super(game, parent, name);

        this.create();
    }

    create() {
        this.bg = game.add.sprite(480, 320, 'intro_2_bg');
        this.nina = game.add.sprite(480, 300, 'intro_2_nina');
        this.fg = game.add.sprite(480, 320, 'intro_2_fg');

        this.bg.scale.setTo(1.3,1.2);
        this.nina.scale.setTo(1.7,1.7);
        this.fg.scale.setTo(2.7,2.5);

        this.bg.anchor.setTo(0.5);
        this.nina.anchor.setTo(0.5);
        this.fg.anchor.setTo(0.5);

        this.add(this.bg);
        this.add(this.nina);
        this.add(this.fg);
    }

    appearAnimation() {
        let time = 1450;
        this.game.add.tween(this.nina.scale).to({ x: "-0.7", y: "-0.7" }, time, Phaser.Easing.Sinusoidal.InOut, true);
        this.game.add.tween(this.bg.scale).to({ x: "-0.15", y: "-0.075" }, time, Phaser.Easing.Sinusoidal.InOut, true);
        this.game.add.tween(this.fg.scale).to({ x: "-1.7", y: "-1.5" }, time, Phaser.Easing.Sinusoidal.InOut, true);
        this.game.add.tween(this.nina).to({  y: "+75" }, time, Phaser.Easing.Sinusoidal.InOut, true);
        this.game.add.tween(this.bg).to({  y: "+40" }, time, Phaser.Easing.Sinusoidal.InOut, true);
    }
}
