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
NAME | TYPE | DESCRIPTION |
---|---|---|
commands | PathCommand[] | The paths commands |
Returns the current builder.
fillRule
fillRule(fillRule);
Set the paths fillRule
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
fillRule | string | The paths fill rule |
Returns the current builder.
style
style(style);
Set the paths style
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
style | PathStyle[] | The paths style |
Returns the current builder.
fillColor
fillColor(fillColor);
Set the path styles fillColor
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
fillColor | string | The paths fill color |
Returns the current builder.
fillOpacity
fillOpacity(fillOpacity);
Set the path styles fillOpacity
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
fillOpacity | number | The paths fill opacity |
Returns the current builder.
strokeColor
strokeColor(strokeColor);
Set the path styles strokeColor
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
strokeColor | string | The paths stroke color |
Returns the current builder.
strokeOpacity
strokeOpacity(strokeOpacity);
Set the path styles strokeOpacity
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
strokeOpacity | number | The paths stroke opacity |
Returns the current builder.
strokeWidth
strokeWidth(strokeWidth);
Set the path styles strokeWidth
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
strokeWidth | number | The paths stroke width |
Returns the current builder.
strokeDash
strokeDash(strokeDash);
Set the path styles strokeDash
.
Parameters
NAME | TYPE | DESCRIPTION |
---|---|---|
strokeDash | number[] | The paths stroke dash |
Returns the current builder.
build
build();
Returns the final Path item.