Skip to content

WPath

Defined in: wpath.ts:12

Represents a dynamic SVG path implementation focused on dynamic path resolution.

Constructors

Constructor

new WPath(points): WPath

Defined in: wpath.ts:21

Creates a path instance based on the specified cubic bezier definition.

Parameters

points

CubicBezierPoints[] = []

Returns

WPath

Properties

segments

segments: WPathSegment[]

Defined in: wpath.ts:16

The segments of the path.

Methods

clone()

clone(): WPath

Defined in: wpath.ts:29

Creates a deep clone of the path instance.

Returns

WPath


getAllPoints()

getAllPoints(): CubicBezierPoints[]

Defined in: wpath.ts:80

Returns the cubic bezier definition points of the path.

Returns

CubicBezierPoints[]


getLength()

getLength(): number

Defined in: wpath.ts:45

Returns an (approximation) of the total path length.

Returns

number


getPathDefinition()

getPathDefinition(): string

Defined in: wpath.ts:87

Returns the SVG path definition string.

Returns

string


interpolate()

interpolate(other, t): WPath

Defined in: wpath.ts:36

Returns a new path that is a linear interpolation of the path against the specified path by t.

Parameters

other

WPath

t

number

Returns

WPath


refine()

refine(count): void

Defined in: wpath.ts:106

Refines the path to have the specified number of segments.

Note that the specified number must be positive and may not be less than the current number of segments. “Simplfying” into less segments may be added in the future.

Parameters

count

number

Returns

void


truncate()

truncate(maxLength): WPath

Defined in: wpath.ts:52

Creates a new path from the current path instance, truncated to the specified (absolute) length.

Parameters

maxLength

number

Returns

WPath


fromPoints()

static fromPoints(points): WPath

Defined in: wpath.ts:190

Parameters

points

Vector2[]

Returns

WPath


fromSVGPath()

static fromSVGPath(pathDefintion): WPath

Defined in: wpath.ts:127

Parameters

pathDefintion

string

Returns

WPath