phaser scene
http://www.html5gamedevs.com/topic/35134-can-i-make-a-menu-screen-that-plays-a-scene-how/
by Gaurav D
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.min.js"></script>
<div id="test"></div>
JavaScript
var game = new Phaser.Game(500, 500, Phaser.AUTO, 'test', {
preload: preload,
create: create,
update: update
});
function preload() {
this.game.load.crossOrigin = true;
this.stage.disableVisibilityChange = true;
this.game.load.image('bg', 'https://i.imgur.com/cYUEyK0.png');
//parallax assets from Josh Morony : https://www.joshmorony.com/how-to-create-a-parallax-background-in-phaser/
this.game.load.image('bg0', 'https://www.joshmorony.com/wp-content/uploads/2016/04/mountains-back.png');
this.game.load.image('bg1', 'https://www.joshmorony.com/wp-content/uploads/2016/04/mountains-mid1.png');
this.game.load.image('bg2', 'https://www.joshmorony.com/wp-content/uploads/2016/04/mountains-mid2.png');
this.game.load.image('logo', 'https://upload.wikimedia.org/wikipedia/en/3/30/Mario_kart_first_logo.png');
this.game.load.image('shark','https://i.imgur.com/rMsGafK.gif');
this.game.load.image('dory','https://i.imgur.com/iL2YxK5.gif');
}
function create() {
//background
this.bg = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'bg');
this.bg.anchor.setTo(0.5);
this.bg.scale.setTo(0.7);
//parallax
this.bg0 = this.game.add.tileSprite(
0, this.game.height * 0.75,
this.game.width, this.game.cache.getImage('bg1').height * 0.2,
'bg0');
this.bg0.anchor.setTo(0, 0.5);
this.bg0.tileScale.setTo(0.2);
this.bg1 = this.game.add.tileSprite(
0, this.game.height * 0.85,
this.game.width, this.game.cache.getImage('bg1').height * 0.2,
'bg1');
this.bg1.anchor.setTo(0, 0.5);
this.bg1.tileScale.setTo(0.2);
this.bg2 = this.game.add.tileSprite(
0, this.game.height * 0.95,
this.game.width, this.game.cache.getImage('bg2').height * 0.2,
'bg2');
this.bg2.anchor.setTo(0, 0.5);
this.bg2.tileScale.setTo(0.2);
//logo
this.logo = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY - 100, 'logo');
this.logo.anchor.setTo(0.5);
this.logo.scale.setTo(0.5);
...