JSFiddle - React, Tailwind, and code Playground
by realhunts
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.60.0-beta.3/phaser.js"></script>
<canvas id="myCustomCanvas"></canvas>
JavaScript
const config = {
type: Phaser.WEBGL,
parent: 'phaser-example',
width: 800,
height: 600,
canvas: document.getElementById('myCustomCanvas'),
scene: {
preload: preload,
create: create
}
};
const game = new Phaser.Game(config);
function preload ()
{
this.load.image('pic', 'https://labs.phaser.io/assets/pics/baal-loader.png');
}
function create ()
{
this.add.image(400, 300, 'pic');
babyloncanv()
}
function babyloncanv(){
console.log(game.canvas)
}