Build Equilateral Triangle

Demonstrates how to create a geometrically perfect equilateral triangle by specifying a starting point and the length of its sides.

Build Equilateral Triangle, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    create ()
    {
        const graphics = this.add.graphics({ lineStyle: { width: 2, color: 0x00ff00 } });

        const triangle = new Phaser.Geom.Triangle.BuildEquilateral(400, 200, 200);

        graphics.strokeTriangleShape(triangle);
    }
}

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

const game = new Phaser.Game(config);

More in Triangle32 examples