Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

layerBorder

layerBorder(options?): FragmentLayer

Defined in: packages/node-border/src/layer.ts:218

Creates a border layer that renders one or more concentric borders around a shape. The borders follow the contour of whatever SDF shape is used.

Parameters

options?

FactoryOptionsFromSchema<{ borders: ArrayPropertySchema<{ color: PropertySchema<string, "color", true>; fill: PropertySchema<boolean, "boolean", false>; mode: PropertySchema<"relative" | "pixels", EnumPropertyType<"relative" | "pixels">, boolean>; size: PropertySchema<number, "number", true>; }>; }>

Border configuration options

Returns

FragmentLayer

FragmentLayer definition

Example

// Simple border with fill
const borderLayer = layerBorder({
borders: [
{ size: 0.1, color: { attribute: "borderColor" }, mode: "relative" },
{ size: 0, color: { attribute: "color" }, fill: true },
],
});
// Use with createNodeProgram
const program = createNodeProgram({
shapes: [sdfSquare({ cornerRadius: 0.1 })],
layers: [borderLayer],
});