JSFiddle - React, Tailwind, and code Playground
by jppresents
HTML
<script src="https://rawgit.com/photonstorm/phaser/dev/build/phaser.js"></script>
<div id="phaser"> </div>
<div id="output">
</div>
JavaScript
var output = $('#output');
var game = new Phaser.Game(400, 500, Phaser.CANVAS, 'phaser', { preload: preload, create: create, update:update});
function preload() {
this.game.load.image("bubble", "http://examples.phaser.io/assets/particles/bubble.png");
}
function create() {
emitter = game.add.emitter(game.world.centerX, 200, 20);
emitter.width = 800;
emitter.makeParticles('bubble');
emitter.minParticleSpeed.set(0, 300);
emitter.maxParticleSpeed.set(0, 400);
emitter.setRotation(0, 0);
emitter.setAlpha(0.3, 0.8);
emitter.setScale(0.5, 0.5, 1, 1);
emitter.gravity = -200;
emitter.start(false, 5000, 100);
var c = 0;
emitter.forEach(function(particle) {
c++;
particle.tint = 0xff0000;
});
console.log(c);
}
function update() {
}