addTriangle(layer, ...properties) -> id , method of scene

Add a new Triangle to this layer of the world.

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

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.

UB.scene.addTriangle(0,{
    x: 300,
    y: 300,
    radius: 60,
    fill: "#F00",
    stroke: "#0F0"
}, {
    mass: 1,
    friction: 0.9,
    elasticity: 0.9
});

See all methods of the api.