Skip to main content

PathBuilder

A builder for the Path item.

Extends GenericItemBuilder

Example

import OBR, { buildPath, Command } from "@owlbear-rodeo/sdk";

const item = buildPath()
.commands([
[Command.MOVE, 0, 0],
[Command.LINE, 150, 0],
[Command.QUAD, 200, 75, 150, 150],
[Command.CLOSE],
])
.build();
OBR.scene.items.addItems([item]);

Reference

Methods

commands

commands(commands: PathCommand[])

Set the paths commands array.

Parameters

NAMETYPEDESCRIPTION
commandsPathCommand[]The paths commands

Returns the current builder.


fillRule

fillRule(fillRule);

Set the paths fillRule.

Parameters

NAMETYPEDESCRIPTION
fillRulestringThe paths fill rule

Returns the current builder.


style

style(style);

Set the paths style.

Parameters

NAMETYPEDESCRIPTION
stylePathStyle[]The paths style

Returns the current builder.


fillColor

fillColor(fillColor);

Set the path styles fillColor.

Parameters

NAMETYPEDESCRIPTION
fillColorstringThe paths fill color

Returns the current builder.


fillOpacity

fillOpacity(fillOpacity);

Set the path styles fillOpacity.

Parameters

NAMETYPEDESCRIPTION
fillOpacitynumberThe paths fill opacity

Returns the current builder.


strokeColor

strokeColor(strokeColor);

Set the path styles strokeColor.

Parameters

NAMETYPEDESCRIPTION
strokeColorstringThe paths stroke color

Returns the current builder.


strokeOpacity

strokeOpacity(strokeOpacity);

Set the path styles strokeOpacity.

Parameters

NAMETYPEDESCRIPTION
strokeOpacitynumberThe paths stroke opacity

Returns the current builder.


strokeWidth

strokeWidth(strokeWidth);

Set the path styles strokeWidth.

Parameters

NAMETYPEDESCRIPTION
strokeWidthnumberThe paths stroke width

Returns the current builder.


strokeDash

strokeDash(strokeDash);

Set the path styles strokeDash.

Parameters

NAMETYPEDESCRIPTION
strokeDashnumber[]The paths stroke dash

Returns the current builder.


build

build();

Returns the final Path item.