@baku89/pave v1.0.1
@baku89/pave v1.0.1
Attributes
AttributeDef
Defined in: path/types.ts:68
The definition of an attribute.
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
default? | readonly | AttributeValue | The value when it is not set on any level |
interpolate? | readonly | AttributeInterpolation | - |
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 Parameter | Default type |
|---|---|
T extends AttributeValue | AttributeValue |
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| readonlynumber[]
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
| Property | Type |
|---|---|
index | number |
path | Path<Vertex> |
VertexContext
Defined in: path/types.ts:84
Where a vertex is, passed to the functions reading it.
Properties
| Property | Type | Description |
|---|---|---|
curve | Curve<Vertex> | - |
curveIndex | number | - |
index | number | The index of the vertex in the curve |
path | Path<Vertex> | - |
Modules
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
| Name | Type |
|---|---|
offset | number |
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
| Name | Type |
|---|---|
time | number |
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 Parameter | Default type |
|---|---|
V extends Vertex | Vertex |
Type declaration
| Name | Type | Description |
|---|---|---|
attrs? | Attributes | The attributes of the whole curve, read when a vertex does not have its own |
closed | boolean | - |
vertices | V[] | - |
CurveA
Defined in: index.ts:81
CurveC
Defined in: index.ts:78
CurveL
Defined in: index.ts:75
CurveLocationIndices
CurveLocationIndices:
object
Defined in: Location.ts:25
Optional segment index when locating on a Curve.
Type declaration
| Name | Type |
|---|---|
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 Parameter | Default type |
|---|---|
V extends Vertex | Vertex |
Type declaration
| Name | Type | Description |
|---|---|---|
attrDefs? | AttributeDefs | The default values and the interpolations of the attributes. This is optional. |
attrs? | Attributes | The attributes of the whole path, read when a curve or a vertex does not have its own |
curves | Curve<V>[] | - |
PathA
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
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
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
| Name | Type |
|---|---|
curveIndex? | number |
segmentIndex? | number |
Segment<V>
Segment<
V>:VextendsVertexL?SegmentL:VextendsVertexC?SegmentC:VextendsVertexA?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 Parameter | Default type |
|---|---|
V extends Vertex | Vertex |
SegmentA
SegmentA:
VertexA&object
Defined in: index.ts:137
Type declaration
| Name | Type | Description |
|---|---|---|
start | vec2 | - |
startAttrs? | Attributes | The attributes of the vertex at start; attrs are those at point |
SegmentC
SegmentC:
VertexC&object
Defined in: index.ts:130
Type declaration
| Name | Type | Description |
|---|---|---|
start | vec2 | - |
startAttrs? | Attributes | The attributes of the vertex at start; attrs are those at point |
SegmentL
SegmentL:
VertexL&object
Defined in: index.ts:123
Type declaration
| Name | Type | Description |
|---|---|---|
start | vec2 | - |
startAttrs? | Attributes | The 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
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
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
| Name | Type |
|---|---|
args | CommandArgsA |
attrs? | Attributes |
command | "A" |
point | vec2 |
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
| Name | Type |
|---|---|
args | CommandArgsC |
attrs? | Attributes |
command | "C" |
point | vec2 |
VertexL
VertexL:
object
Defined in: path/types.ts:118
A vertex representing a line (L) command.
Type declaration
| Name | Type |
|---|---|
args? | undefined |
attrs? | Attributes |
command | "L" |
point | vec2 |
See
https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands