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.
Shape.CIRCLE = 0;
Shape.RECTANGLE = 1;
Shape.LINE = 2;
Shape.TRIANGLE = 3;
Shape.POLYGON = 4;
Name | Type | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
geometry | number | Shape.CIRCLE | The Geometry of the shape. | ||||||||||||||||||||||||
color | Color | Color.fuchsia | The color of the shape. | ||||||||||||||||||||||||
fill | boolean | true | Whether the shape is filled or not. | ||||||||||||||||||||||||
param | Object | More Optional parameters for the shape. Properties
|
// 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.
fill :boolean
Fill the shape or not.
- boolean
filter
The filter applied to the object
- Inherited From
geometry :number
Geometry of the shape. Can be one of the following:
Shape.CIRCLE = 0;
Shape.RECTANGLE = 1;
Shape.LINE = 2;
Shape.TRIANGLE = 3;
Shape.POLYGON = 4;
- number
height
If the shape is Rectangle. The height of the rectangle.
outline :Color
Outline of the shape.
(readonly) properties
The entity that this component is attached to.
- Inherited From
- Source
radius :number
If shape is Circle. The radius of the circle.
- number
thickness :number
The thickness of the outline of the shape.
- number
width :number
If the shape is Rectangle. The width of the rectangle.
- number