Render Particle Emitter to Render Texture

Learn how to draw a hidden particle emitter into a Render Texture and manipulate the output using the Render Texture camera's rotation.

Render Particle Emitter to Render Texture, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    particles;
    rt;

    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json');
    }

    create ()
    {
        this.particles = this.add.particles(0, 0, 'flares', {
            frame: 'blue',
            x: 400,
            y: 300,
            lifespan: 2000,
            speed: { min: 400, max: 600 },
            angle: 0,
            gravityY: 300,
            scale: { start: 0.4, end: 0 },
            quantity: 2,
            blendMode: 'ADD'
        });

        this.particles.setVisible(false);

        this.rt = this.add.renderTexture(400, 300, 800, 600);
    }

    update ()
    {
        this.rt.camera.rotation -= 0.01;

        this.rt.clear();

        this.rt.draw(this.particles, 0, 0);

        this.rt.render();
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    parent: 'game-container',
    width: 800,
    height: 600,
    scene: Example
};

const game = new Phaser.Game(config);

More in Render Texture45 examples