/
api.ts
49 lines (41 loc) · 998 Bytes
/
api.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import type { Fn } from "@thi.ng/api";
import type { IColor } from "@thi.ng/color";
import { Polygon } from "@thi.ng/geom";
import type { IHiccupShape } from "@thi.ng/geom-api";
export type Color = string | number[] | IColor;
export type FillFn = Fn<Polygon, IHiccupShape>;
export type HatchDir = "d" | "h" | "v";
export interface FuzzyPolygonOpts {
num: number;
jitter: number;
curveBreakPoints: boolean;
curveScale: number;
fill: FillFn;
}
export interface FuzzyLineOpts {
jitter: number;
resample: number;
attribs: any;
}
export interface HatchOpts {
dir: HatchDir;
space: number;
line: Partial<FuzzyLineOpts>;
}
export interface DotFillOpts {
space: number;
jitter: number;
attribs: Partial<{
shape: "circle" | "square";
[id: string]: any;
}>;
}
export const DEFAULT_LINE = {
resample: 0,
jitter: 2,
attribs: {
lineCap: "butt",
lineJoin: "round",
stroke: "black",
},
};