ShapeContainerMixin.createStroke
Adds a stroke to this container
ShapeContainerMixin.createStroke() method
Adds a stroke to this container
Signature:
createStroke(opts: StrokeOptions): Stroke;Parameters
Parameter | Type | Description |
|---|---|---|
opts | The stroke options |
Returns:
The newly created stroke
Example
// Add a solid black stroke
layer.createStroke({
fill: { type: "SOLID", color: { r: 0, g: 0, b: 0 } },
width: 2,
});
// Add a gradient stroke
layer.createStroke({
fill: {
type: "GRADIENT_LINEAR",
stops: [
{ color: { r: 255, g: 0, b: 0 }, offset: 0, opacity: 1 },
{ color: { r: 0, g: 0, b: 255 }, offset: 1, opacity: 1 },
],
},
width: 5,
});Last updated: August 5, 2026 at 11:47 AMEdit this page