Jump to content

Does the particle system work in CANVAS?


Recommended Posts

After many hours of head scratching I've discovered that I cannot get particles to work in canvas. However, if I switch to game type AUTO, the particle emitter works.

Is there any way to get particles to work in canvas mode or is it not supported?

import 'phaser';

window.onload = function(){
    var config = {
        type: Phaser.CANVAS, // Particles won't render unless setting is Phaser.AUTO
        parent: 'phaser-example',
        width: 800,
        height: 600,
        scene: PlayGame

    var game = new Phaser.Game(config);

class PlayGame extends Phaser.Scene{

        this.load.image('block', 'assets/block.png');

        this.block = this.add.particles('block');
            angle: { min: 240, max: 300 },
            speed: { min: 200, max: 300 },
            quantity: 6,
            lifespan: 2000,
            alpha: { start: 1, end: 0 },
            scale: { start: 1.5, end: 0.5 },
            on: false

        this.input.on('pointerdown', function (pointer) {
            this.block.emitParticleAt(pointer.x, pointer.y);
        }, this);



Link to comment
Share on other sites

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...