Shape#

new Shape()#

Shape Component is responsible for rendering a shape to the screen. Basic Shapes such as circles, rectangles, etc. can be rendered using this component.

CODE
Shape.CIRCLE = 0;
Shape.RECTANGLE = 1;
Shape.LINE = 2;
Shape.TRIANGLE = 3;
Shape.POLYGON = 4;
Properties
NameTypeDefaultDescription
geometrynumberShape.CIRCLE

The Geometry of the shape.

colorColorColor.fuchsia

The color of the shape.

fillbooleantrue

Whether the shape is filled or not.

paramObject

More Optional parameters for the shape.

Properties
NameTypeDefaultDescription
radiusnumber10

The radius of the shape.

widthnumber10

The width of the shape.

heightnumber10

The height of the shape.

outlineColorColor.black

The color of the outline of the shape.

thicknessnumber1

The thickness of the outline of the shape.

Example
CODE
// Create a shape component
let shape = new Shape(Shape.CIRCLE,Color.fuchsia,true,{radius:10});
// Add the shape component to an entity
entity.addComponent(shape);

Extends#

Members#

blendMode#

Blend mode of the object

Inherited From

color :Color#

Color of the shape.

Type:

fill :boolean#

Fill the shape or not.

Type:
  • boolean

filter#

The filter applied to the object

Inherited From

geometry :number#

Geometry of the shape. Can be one of the following:

CODE
Shape.CIRCLE = 0;
Shape.RECTANGLE = 1;
Shape.LINE = 2;
Shape.TRIANGLE = 3;
Shape.POLYGON = 4;
Type:
  • number

height#

If the shape is Rectangle. The height of the rectangle.

outline :Color#

Outline of the shape.

Type:

(readonly) properties#

The entity that this component is attached to.

Inherited From

radius :number#

If shape is Circle. The radius of the circle.

Type:
  • number

thickness :number#

The thickness of the outline of the shape.

Type:
  • number

width :number#

If the shape is Rectangle. The width of the rectangle.

Type:
  • number