Skip to main content

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

NAMETYPEDESCRIPTION
widthnumberThe shapes width

Returns the current builder.


height

height(height: number)

Set the shapes height.

Parameters

NAMETYPEDESCRIPTION
heightnumberThe shapes height

Returns the current builder.


shapeType

shapeType(shapeType);

Set the shapes shapeType.

Parameters

NAMETYPEDESCRIPTION
shapeType"RECTANGLE" | "CIRCLE" | "TRIANGLE" | "HEXAGON"The shapes type

Returns the current builder.


style

style(style);

Set the shapes style.

Parameters

NAMETYPEDESCRIPTION
styleShapeStyle[]The shapes style

Returns the current builder.


fillColor

fillColor(fillColor);

Set the shape styles fillColor.

Parameters

NAMETYPEDESCRIPTION
fillColorstringThe shapes fill color

Returns the current builder.


fillOpacity

fillOpacity(fillOpacity);

Set the shape styles fillOpacity.

Parameters

NAMETYPEDESCRIPTION
fillOpacitynumberThe shapes fill opacity

Returns the current builder.


strokeColor

strokeColor(strokeColor);

Set the shape styles strokeColor.

Parameters

NAMETYPEDESCRIPTION
strokeColorstringThe shapes stroke color

Returns the current builder.


strokeOpacity

strokeOpacity(strokeOpacity);

Set the shape styles strokeOpacity.

Parameters

NAMETYPEDESCRIPTION
strokeOpacitynumberThe shapes stroke opacity

Returns the current builder.


strokeWidth

strokeWidth(strokeWidth);

Set the shape styles strokeWidth.

Parameters

NAMETYPEDESCRIPTION
strokeWidthnumberThe shapes stroke width

Returns the current builder.


strokeDash

strokeDash(strokeDash);

Set the shape styles strokeDash.

Parameters

NAMETYPEDESCRIPTION
strokeDashnumber[]The shapes stroke dash

Returns the current builder.


build

build();

Returns the final Shape item.