addTriangle(layer, -> id , method of scene

Add a new Triangle to this layer of the world.

name type description
layer int layer of the world (must be >= 0)
properties …Object each with Sprite properties for a Triangle

the identifier (int) of the sprite

// a new Triangle with its center at 200,300 and radius (center to each corner) of 60.

UB.scene.addTriangle(0, {x:200, y:300, radius: 60});

Example with physical properties.

    x: 300,
    y: 300,
    radius: 60,
    fill: "#F00",
    stroke: "#0F0"
}, {
    mass: 1,
    friction: 0.9,
    elasticity: 0.9

See all methods of the api.