PavePave
Home
Guide
API
Sandbox
  • English
  • 日本語
GitHub
Home
Guide
API
Sandbox
  • English
  • 日本語
GitHub
  • @baku89/pave v1.0.1

@baku89/pave v1.0.1


@baku89/pave v1.0.1

Attributes

AttributeDef

Defined in: path/types.ts:68

The definition of an attribute.

Properties

PropertyModifierTypeDescription
default?readonlyAttributeValueThe value when it is not set on any level
interpolate?readonlyAttributeInterpolation-

AttributeDefs

AttributeDefs: Readonly<Record<string, AttributeDef>>

Defined in: path/types.ts:75


AttributeInterpolation

AttributeInterpolation: "linear" | "oklab" | "step" | "and" | (a, b, t) => AttributeValue

Defined in: path/types.ts:57

How an attribute changes along a segment. The names keep a path representable in JSON.

  • linear: Interpolates numbers and arrays of numbers.
  • oklab: Regards [r, g, b] or [r, g, b, a] as sRGB in the range of 0 to 1, and interpolates in OKLab.
  • step: Keeps the value of the start.
  • and: Becomes true only when both ends are true.

A function must not depend on how the segment is subdivided: interpolating at t between a and the value at s must equal interpolating at s * t between a and b.


AttributeLevel

AttributeLevel: "vertex" | "curve" | "path"

Defined in: path/types.ts:78


AttributeLike<T>

AttributeLike<T>: Exclude<T, string> | string | (vertex, context) => T

Defined in: path/types.ts:102

Anything that can be read like an attribute of a vertex: a constant, the name of a stored attribute, or a function computing it on the fly.

Type Parameters

Type ParameterDefault type
T extends AttributeValueAttributeValue

Attributes

Attributes: Readonly<Record<string, AttributeValue>>

Defined in: path/types.ts:44

Named attributes. They can be set on a vertex, a curve or a whole path; reading one looks up those levels in this order. A group is just a boolean attribute.


AttributeValue

AttributeValue: number | boolean | string | readonly number[]

Defined in: path/types.ts:38

The value of an attribute. Numbers and arrays of numbers can be interpolated.


CurveContext

Defined in: path/types.ts:93

Properties

PropertyType
indexnumber
pathPath<Vertex>

VertexContext

Defined in: path/types.ts:84

Where a vertex is, passed to the functions reading it.

Properties

PropertyTypeDescription
curveCurve<Vertex>-
curveIndexnumber-
indexnumberThe index of the vertex in the curve
pathPath<Vertex>-

Modules

  • Arc
  • CubicBezier
  • Curve
  • Line
  • Path
  • Segment

Other

CurveGroup

CurveGroup: number | number[] | Set<number> | (curve, index) => boolean

Defined in: index.ts:89


CurveLocation

CurveLocation: UnitCurveLocation | OffsetCurveLocation | TimeCurveLocation

Defined in: Location.ts:16

Represents a location on a single curve


OffsetCurveLocation

OffsetCurveLocation: OffsetSegmentLocation & CurveLocationIndices

Defined in: Location.ts:30


OffsetPathLocation

OffsetPathLocation: OffsetSegmentLocation & PathLocationIndices

Defined in: Location.ts:51


OffsetSegmentLocation

OffsetSegmentLocation: object

Defined in: Location.ts:10

Type declaration

NameType
offsetnumber

PathLocation

PathLocation: UnitPathLocation | OffsetPathLocation | TimePathLocation

Defined in: Location.ts:45

Represents a location on a path


SegmentLocation

SegmentLocation: UnitSegmentLocation | OffsetSegmentLocation | TimeSegmentLocation

Defined in: Location.ts:4

Represents a location on a single segment


TimeCurveLocation

TimeCurveLocation: TimeSegmentLocation & CurveLocationIndices

Defined in: Location.ts:31


TimePathLocation

TimePathLocation: TimeSegmentLocation & PathLocationIndices

Defined in: Location.ts:52


TimeSegmentLocation

TimeSegmentLocation: object

Defined in: Location.ts:11

Type declaration

NameType
timenumber

UnitCurveLocation

UnitCurveLocation: number | object & CurveLocationIndices

Defined in: Location.ts:29


UnitPathLocation

UnitPathLocation: number | object & PathLocationIndices

Defined in: Location.ts:50


UnitSegmentLocation

UnitSegmentLocation: number | { unit: number; }

Defined in: Location.ts:9

Types

AngleRange

AngleRange: readonly [number, number]

Defined in: index.ts:33

The angle range to check. startAngle is always in the range of [-π, π], and the endAngle is relative angle considering the rotation direction, with start angle as a reference.


BareSegmentA

BareSegmentA: Omit<SegmentA, "command">

Defined in: index.ts:39

Almost equivalent to SegmentA, but the redundant command field can be omitted. Used for the argument of Arc functions.


BareSegmentC

BareSegmentC: Omit<SegmentC, "command">

Defined in: index.ts:51

Almost equivalent to SegmentC, but the redundant command field can be omitted. Used for the argument of CubicBezier functions.


BareSegmentL

BareSegmentL: Omit<SegmentL, "command">

Defined in: index.ts:101

Almost equivalent to SegmentL, but the redundant command field can be omitted. Used for the argument of Line functions.


CommandArgsA

CommandArgsA: readonly [vec2, number, boolean, boolean]

Defined in: path/types.ts:15

Arguments for arc (A) command

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#arcs


CommandArgsC

CommandArgsC: readonly [vec2, vec2]

Defined in: path/types.ts:8

Arguments for cubic Bézier curve (C) command.

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands


Curve<V>

Curve<V>: object

Defined in: index.ts:67

A single open or closed stroke represented as an array of vertices. All of the points are represented as tuple [x: number, y: number] and the commands are represented in absolute form.

Values are immutable: do not mutate vertices or their elements in place. Curve helpers may memoize by reference.

Type Parameters

Type ParameterDefault type
V extends VertexVertex

Type declaration

NameTypeDescription
attrs?AttributesThe attributes of the whole curve, read when a vertex does not have its own
closedboolean-
verticesV[]-

CurveA

CurveA: Curve<VertexA>

Defined in: index.ts:81


CurveC

CurveC: Curve<VertexC>

Defined in: index.ts:78


CurveL

CurveL: Curve<VertexL>

Defined in: index.ts:75


CurveLocationIndices

CurveLocationIndices: object

Defined in: Location.ts:25

Optional segment index when locating on a Curve.

Type declaration

NameType
segmentIndex?number

PartialBy<T, K>

PartialBy<T, K>: Omit<T, K> & Partial<Pick<T, K>>

Defined in: utils.ts:41

Makes the given keys of T optional.

Type Parameters

Type Parameter
T
K extends keyof T

Path<V>

Path<V>: object

Defined in: index.ts:165

A path that consists of multiple curves.

Values are immutable: do not mutate curves, nested curves, or vertices in place. Path helpers may memoize by reference.

Type Parameters

Type ParameterDefault type
V extends VertexVertex

Type declaration

NameTypeDescription
attrDefs?AttributeDefsThe default values and the interpolations of the attributes. This is optional.
attrs?AttributesThe attributes of the whole path, read when a curve or a vertex does not have its own
curvesCurve<V>[]-

PathA

PathA: Path<VertexA>

Defined in: index.ts:192

A path that only consists of arc (A) commands.

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands


PathC

PathC: Path<VertexC>

Defined in: index.ts:185

A path that only consists of cubic Bézier curve (C) commands.

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands


PathL

PathL: Path<VertexL>

Defined in: index.ts:178

A path that only consists of line (L) commands, which is a simple polygon or polyline.

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands


PathLocationIndices

PathLocationIndices: object

Defined in: Location.ts:37

Optional curve and segment indices when locating on a Path.

Type declaration

NameType
curveIndex?number
segmentIndex?number

Segment<V>

Segment<V>: V extends VertexL ? SegmentL : V extends VertexC ? SegmentC : V extends VertexA ? SegmentA : SegmentL | SegmentC | SegmentA

Defined in: index.ts:114

A segment of a path, which consists of a starting point, end point, and an interpolation command.

Type Parameters

Type ParameterDefault type
V extends VertexVertex

SegmentA

SegmentA: VertexA & object

Defined in: index.ts:137

Type declaration

NameTypeDescription
startvec2-
startAttrs?AttributesThe attributes of the vertex at start; attrs are those at point

SegmentC

SegmentC: VertexC & object

Defined in: index.ts:130

Type declaration

NameTypeDescription
startvec2-
startAttrs?AttributesThe attributes of the vertex at start; attrs are those at point

SegmentL

SegmentL: VertexL & object

Defined in: index.ts:123

Type declaration

NameTypeDescription
startvec2-
startAttrs?AttributesThe attributes of the vertex at start; attrs are those at point

SVGCommand

SVGCommand: "M" | "L" | "H" | "V" | "Q" | "T" | "C" | "S" | "A" | "Z" | "m" | "l" | "h" | "v" | "q" | "t" | "c" | "s" | "a" | "z" | vec2 | boolean | number

Defined in: path/types.ts:152

A token or numeric argument in a sequence passed to Path.fromSVG.


UnarcPath

UnarcPath: Path<VertexL | VertexC>

Defined in: index.ts:198

A path that does not contain any VertexA. It can be obtained by Path.unarc, while approximating arcs to cubic Bézier curves. In some non-affine transformations such as Path.distort, all arcs are internally converted to this type of path.


Vertex

Vertex: VertexL | VertexC | VertexA

Defined in: path/types.ts:111

A vertex of a path. It consists of a end point and an interpolation command from the previous vertex, which is either a line (L) command, a cubic Bézier curve (C) command, or an arc (A) command.


VertexA

VertexA: object

Defined in: path/types.ts:141

A vertex representing an arc (A) command.

Type declaration

NameType
argsCommandArgsA
attrs?Attributes
command"A"
pointvec2

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#arcs


VertexC

VertexC: object

Defined in: path/types.ts:129

A vertex representing a cubic Bézier curve (C) command.

Type declaration

NameType
argsCommandArgsC
attrs?Attributes
command"C"
pointvec2

VertexL

VertexL: object

Defined in: path/types.ts:118

A vertex representing a line (L) command.

Type declaration

NameType
args?undefined
attrs?Attributes
command"L"
pointvec2

See

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands

Edit this page