ShapeBuilder
A builder for the Shape item.
Extends GenericItemBuilder
Example
import OBR, { buildShape } from "@owlbear-rodeo/sdk";
const item = buildShape().width(10).height(10).shapeType("CIRCLE").build();
OBR.scene.items.addItems([item]);
Reference
Methods
width
width(width);
Set the shapes width.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| width | number | The shapes width |
Returns the current builder.
height
height(height: number)
Set the shapes height.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| height | number | The shapes height |
Returns the current builder.
shapeType
shapeType(shapeType);
Set the shapes shapeType.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| shapeType | "RECTANGLE" | "CIRCLE" | "TRIANGLE" | "HEXAGON" | The shapes type |
Returns the current builder.
style
style(style);
Set the shapes style.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| style | ShapeStyle[] | The shapes style |
Returns the current builder.
fillColor
fillColor(fillColor);
Set the shape styles fillColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillColor | string | The shapes fill color |
Returns the current builder.
fillOpacity
fillOpacity(fillOpacity);
Set the shape styles fillOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillOpacity | number | The shapes fill opacity |
Returns the current builder.
strokeColor
strokeColor(strokeColor);
Set the shape styles strokeColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeColor | string | The shapes stroke color |
Returns the current builder.
strokeOpacity
strokeOpacity(strokeOpacity);
Set the shape styles strokeOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeOpacity | number | The shapes stroke opacity |
Returns the current builder.
strokeWidth
strokeWidth(strokeWidth);
Set the shape styles strokeWidth.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeWidth | number | The shapes stroke width |
Returns the current builder.
strokeDash
strokeDash(strokeDash);
Set the shape styles strokeDash.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeDash | number[] | The shapes stroke dash |
Returns the current builder.
build
build();
Returns the final Shape item.