pts 0.10.12 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{pts.d.ts → index.d.ts} +1248 -1206
- package/dist/index.js +6825 -6660
- package/dist/index.mjs +6785 -0
- package/package.json +15 -33
- package/dist/es2015/Canvas.js +0 -684
- package/dist/es2015/Canvas.js.map +0 -1
- package/dist/es2015/Color.js +0 -337
- package/dist/es2015/Color.js.map +0 -1
- package/dist/es2015/Create.js +0 -275
- package/dist/es2015/Create.js.map +0 -1
- package/dist/es2015/Dom.js +0 -448
- package/dist/es2015/Dom.js.map +0 -1
- package/dist/es2015/Form.js +0 -80
- package/dist/es2015/Form.js.map +0 -1
- package/dist/es2015/Image.js +0 -220
- package/dist/es2015/Image.js.map +0 -1
- package/dist/es2015/LinearAlgebra.js +0 -286
- package/dist/es2015/LinearAlgebra.js.map +0 -1
- package/dist/es2015/Num.js +0 -477
- package/dist/es2015/Num.js.map +0 -1
- package/dist/es2015/Op.js +0 -978
- package/dist/es2015/Op.js.map +0 -1
- package/dist/es2015/Physics.js +0 -383
- package/dist/es2015/Physics.js.map +0 -1
- package/dist/es2015/Play.js +0 -339
- package/dist/es2015/Play.js.map +0 -1
- package/dist/es2015/Pt.js +0 -463
- package/dist/es2015/Pt.js.map +0 -1
- package/dist/es2015/Space.js +0 -331
- package/dist/es2015/Space.js.map +0 -1
- package/dist/es2015/Svg.js +0 -367
- package/dist/es2015/Svg.js.map +0 -1
- package/dist/es2015/Types.js +0 -3
- package/dist/es2015/Types.js.map +0 -1
- package/dist/es2015/Typography.js +0 -40
- package/dist/es2015/Typography.js.map +0 -1
- package/dist/es2015/UI.js +0 -273
- package/dist/es2015/UI.js.map +0 -1
- package/dist/es2015/Util.js +0 -200
- package/dist/es2015/Util.js.map +0 -1
- package/dist/es2015/_lib.js +0 -45
- package/dist/es2015/_lib.js.map +0 -1
- package/dist/es2015/_module.js +0 -18
- package/dist/es2015/_module.js.map +0 -1
- package/dist/es2015/uheprng.js +0 -69
- package/dist/es2015/uheprng.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/webpack.es5.js +0 -82
|
@@ -1,1012 +1,1134 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
2
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
|
-
|
|
3
|
+
declare const UIShape: {
|
|
4
|
+
rectangle: string;
|
|
5
|
+
circle: string;
|
|
6
|
+
polygon: string;
|
|
7
|
+
polyline: string;
|
|
8
|
+
line: string;
|
|
9
|
+
};
|
|
10
|
+
declare const UIPointerActions: {
|
|
11
|
+
up: string;
|
|
12
|
+
down: string;
|
|
13
|
+
move: string;
|
|
14
|
+
drag: string;
|
|
15
|
+
uidrag: string;
|
|
16
|
+
drop: string;
|
|
17
|
+
uidrop: string;
|
|
18
|
+
over: string;
|
|
19
|
+
out: string;
|
|
20
|
+
enter: string;
|
|
21
|
+
leave: string;
|
|
22
|
+
click: string;
|
|
23
|
+
keydown: string;
|
|
24
|
+
keyup: string;
|
|
25
|
+
contextmenu: string;
|
|
26
|
+
all: string;
|
|
27
|
+
};
|
|
28
|
+
declare class UI {
|
|
29
|
+
_group: Group;
|
|
30
|
+
_shape: string;
|
|
31
|
+
protected static _counter: number;
|
|
32
|
+
protected _id: string;
|
|
33
|
+
protected _actions: {
|
|
34
|
+
[type: string]: UIHandler[];
|
|
35
|
+
};
|
|
36
|
+
protected _states: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
protected _holds: Map<number, string>;
|
|
40
|
+
constructor(group: PtLikeIterable, shape: string, states?: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}, id?: string);
|
|
43
|
+
static fromRectangle(group: PtLikeIterable, states: {}, id?: string): UI;
|
|
44
|
+
static fromCircle(group: PtLikeIterable, states: {}, id?: string): UI;
|
|
45
|
+
static fromPolygon(group: PtLikeIterable, states: {}, id?: string): UI;
|
|
46
|
+
static fromUI(ui: UI, states?: object, id?: string): UI;
|
|
47
|
+
get id(): string;
|
|
48
|
+
set id(d: string);
|
|
49
|
+
get group(): Group;
|
|
50
|
+
set group(d: Group);
|
|
51
|
+
get shape(): string;
|
|
52
|
+
set shape(d: string);
|
|
53
|
+
state(key: string, value?: any): any;
|
|
54
|
+
on(type: string, fn: UIHandler): number;
|
|
55
|
+
off(type: string, which?: number): boolean;
|
|
56
|
+
listen(type: string, p: PtLike, evt: MouseEvent): boolean;
|
|
57
|
+
protected hold(type: string): number;
|
|
58
|
+
protected unhold(key?: number): void;
|
|
59
|
+
static track(uis: UI[], type: string, p: PtLike, evt: MouseEvent): void;
|
|
60
|
+
render(fn: (group: Group, states: {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}) => void): void;
|
|
63
|
+
toString(): string;
|
|
64
|
+
protected _within(p: PtLike): boolean;
|
|
65
|
+
protected static _trigger(fns: UIHandler[], target: UI, pt: PtLike, type: string, evt: MouseEvent): void;
|
|
66
|
+
protected static _addHandler(fns: UIHandler[], fn: UIHandler): number;
|
|
67
|
+
protected static _removeHandler(fns: UIHandler[], index: number): boolean;
|
|
40
68
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fill(c: string | boolean | CanvasGradient | CanvasPattern): this;
|
|
53
|
-
stroke(c: string | boolean | CanvasGradient | CanvasPattern, width?: number, linejoin?: CanvasLineJoin, linecap?: CanvasLineCap): this;
|
|
54
|
-
applyFillStroke(filled?: boolean | string, stroked?: boolean | string, strokeWidth?: number): this;
|
|
55
|
-
gradient(stops: [number, string][] | string[]): ((area1: GroupLike, area2?: GroupLike) => CanvasGradient);
|
|
56
|
-
composite(mode?: string): this;
|
|
57
|
-
clip(): this;
|
|
58
|
-
dash(segments?: PtLike | boolean, offset?: number): this;
|
|
59
|
-
font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
60
|
-
fontWidthEstimate(estimate?: boolean): this;
|
|
61
|
-
getTextWidth(c: string): number;
|
|
62
|
-
protected _textTruncate(str: string, width: number, tail?: string): [string, number];
|
|
63
|
-
protected _textAlign(box: PtLikeIterable, vertical: string, offset?: PtLike, center?: Pt): Pt;
|
|
64
|
-
reset(): this;
|
|
65
|
-
protected _paint(): void;
|
|
66
|
-
static point(ctx: CanvasRenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
|
|
67
|
-
point(p: PtLike, radius?: number, shape?: string): this;
|
|
68
|
-
static circle(ctx: CanvasRenderingContext2D, pt: PtLike, radius?: number): void;
|
|
69
|
-
circle(pts: PtLikeIterable): this;
|
|
70
|
-
static ellipse(ctx: CanvasRenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
|
|
71
|
-
ellipse(pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): this;
|
|
72
|
-
static arc(ctx: CanvasRenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
|
|
73
|
-
arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
74
|
-
static square(ctx: CanvasRenderingContext2D, pt: PtLike, halfsize: number): void;
|
|
75
|
-
square(pt: PtLike, halfsize: number): this;
|
|
76
|
-
static line(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
77
|
-
line(pts: PtLikeIterable): this;
|
|
78
|
-
static polygon(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
79
|
-
polygon(pts: PtLikeIterable): this;
|
|
80
|
-
static rect(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
81
|
-
rect(pts: PtLikeIterable): this;
|
|
82
|
-
static image(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
|
|
83
|
-
image(ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): this;
|
|
84
|
-
static imageData(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
|
|
85
|
-
imageData(ptOrRect: PtLike | PtLikeIterable, img: ImageData): this;
|
|
86
|
-
static text(ctx: CanvasRenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
|
|
87
|
-
text(pt: PtLike, txt: string, maxWidth?: number): this;
|
|
88
|
-
textBox(box: PtIterable, txt: string, verticalAlign?: string, tail?: string, overrideBaseline?: boolean): this;
|
|
89
|
-
paragraphBox(box: PtLikeIterable, txt: string, lineHeight?: number, verticalAlign?: string, crop?: boolean): this;
|
|
90
|
-
alignText(alignment?: CanvasTextAlign, baseline?: CanvasTextBaseline): this;
|
|
91
|
-
log(txt: any): this;
|
|
69
|
+
declare class UIButton extends UI {
|
|
70
|
+
private _hoverID;
|
|
71
|
+
constructor(group: PtLikeIterable, shape: string, states?: {
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
}, id?: string);
|
|
74
|
+
onClick(fn: UIHandler): number;
|
|
75
|
+
offClick(id: number): boolean;
|
|
76
|
+
onContextMenu(fn: UIHandler): number;
|
|
77
|
+
offContextMenu(id: number): boolean;
|
|
78
|
+
onHover(enter?: UIHandler, leave?: UIHandler): number[];
|
|
79
|
+
offHover(enterID?: number, leaveID?: number): boolean[];
|
|
92
80
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
static lab(...args: any[]): Color;
|
|
106
|
-
static lch(...args: any[]): Color;
|
|
107
|
-
static luv(...args: any[]): Color;
|
|
108
|
-
static xyz(...args: any[]): Color;
|
|
109
|
-
static maxValues(mode: string): Pt;
|
|
110
|
-
get hex(): string;
|
|
111
|
-
get rgb(): string;
|
|
112
|
-
get rgba(): string;
|
|
113
|
-
clone(): Color;
|
|
114
|
-
toMode(mode: ColorType, convert?: boolean): this;
|
|
115
|
-
get mode(): ColorType;
|
|
116
|
-
get r(): number;
|
|
117
|
-
set r(n: number);
|
|
118
|
-
get g(): number;
|
|
119
|
-
set g(n: number);
|
|
120
|
-
get b(): number;
|
|
121
|
-
set b(n: number);
|
|
122
|
-
get h(): number;
|
|
123
|
-
set h(n: number);
|
|
124
|
-
get s(): number;
|
|
125
|
-
set s(n: number);
|
|
126
|
-
get l(): number;
|
|
127
|
-
set l(n: number);
|
|
128
|
-
get a(): number;
|
|
129
|
-
set a(n: number);
|
|
130
|
-
get c(): number;
|
|
131
|
-
set c(n: number);
|
|
132
|
-
get u(): number;
|
|
133
|
-
set u(n: number);
|
|
134
|
-
get v(): number;
|
|
135
|
-
set v(n: number);
|
|
136
|
-
set alpha(n: number);
|
|
137
|
-
get alpha(): number;
|
|
138
|
-
get normalized(): boolean;
|
|
139
|
-
set normalized(b: boolean);
|
|
140
|
-
normalize(toNorm?: boolean): Color;
|
|
141
|
-
$normalize(toNorm?: boolean): Color;
|
|
142
|
-
toString(format?: ("hex" | "rgb" | "rgba" | "mode")): string;
|
|
143
|
-
static RGBtoHSL(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
144
|
-
static HSLtoRGB(hsl: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
145
|
-
static RGBtoHSB(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
146
|
-
static HSBtoRGB(hsb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
147
|
-
static RGBtoLAB(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
148
|
-
static LABtoRGB(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
149
|
-
static RGBtoLCH(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
150
|
-
static LCHtoRGB(lch: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
151
|
-
static RGBtoLUV(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
152
|
-
static LUVtoRGB(luv: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
153
|
-
static RGBtoXYZ(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
154
|
-
static XYZtoRGB(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
155
|
-
static XYZtoLAB(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
156
|
-
static LABtoXYZ(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
157
|
-
static XYZtoLUV(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
158
|
-
static LUVtoXYZ(luv: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
159
|
-
static LABtoLCH(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
160
|
-
static LCHtoLAB(lch: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
81
|
+
declare class UIDragger extends UIButton {
|
|
82
|
+
private _draggingID;
|
|
83
|
+
private _moveHoldID;
|
|
84
|
+
private _dropHoldID;
|
|
85
|
+
private _upHoldID;
|
|
86
|
+
constructor(group: PtLikeIterable, shape: string, states?: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}, id?: string);
|
|
89
|
+
onDrag(fn: UIHandler): number;
|
|
90
|
+
offDrag(id: number): boolean;
|
|
91
|
+
onDrop(fn: UIHandler): number;
|
|
92
|
+
offDrop(id: number): boolean;
|
|
161
93
|
}
|
|
162
94
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
static delaunay(pts: GroupLike): Delaunay;
|
|
95
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
96
|
+
|
|
97
|
+
interface IPt {
|
|
98
|
+
x?: number;
|
|
99
|
+
y?: number;
|
|
100
|
+
z?: number;
|
|
101
|
+
w?: number;
|
|
171
102
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
103
|
+
declare type PtLike = Pt | Float32Array | number[];
|
|
104
|
+
declare type GroupLike = Group | Pt[];
|
|
105
|
+
declare type PtIterable = GroupLike | Pt[] | Iterable<Pt>;
|
|
106
|
+
declare type PtLikeIterable = GroupLike | PtLike[] | Iterable<PtLike>;
|
|
107
|
+
declare type AnimateCallbackFn = (time?: number, frameTime?: number, currentSpace?: any) => void;
|
|
108
|
+
interface IPlayer {
|
|
109
|
+
animateID?: string;
|
|
110
|
+
animate?: AnimateCallbackFn;
|
|
111
|
+
resize?(bound: Bound, evt?: Event): void;
|
|
112
|
+
action?(type: string, px: number, py: number, evt: Event): void;
|
|
113
|
+
start?(bound: Bound, space: Space): void;
|
|
179
114
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
voronoi(): Group[];
|
|
183
|
-
mesh(): DelaunayMesh;
|
|
184
|
-
neighborPts(i: number, sort?: boolean): GroupLike;
|
|
185
|
-
neighbors(i: number): DelaunayShape[];
|
|
186
|
-
protected _cache(o: any): void;
|
|
187
|
-
protected _superTriangle(): Group;
|
|
188
|
-
protected _triangle(i: number, j: number, k: number, pts?: GroupLike): Group;
|
|
189
|
-
protected _circum(i: number, j: number, k: number, tri: GroupLike | false, pts?: GroupLike): DelaunayShape;
|
|
190
|
-
protected static _dedupe(edges: number[]): number[];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export class DOMSpace extends MultiTouchSpace {
|
|
194
|
-
protected _canvas: HTMLElement | SVGElement;
|
|
195
|
-
protected _container: Element;
|
|
196
|
-
id: string;
|
|
197
|
-
protected _autoResize: boolean;
|
|
198
|
-
protected _bgcolor: string;
|
|
199
|
-
protected _css: {};
|
|
200
|
-
constructor(elem: string | Element, callback?: Function);
|
|
201
|
-
static createElement(elem: string, id: string, appendTo?: Element): Element;
|
|
202
|
-
setup(opt: {
|
|
203
|
-
bgcolor?: string;
|
|
204
|
-
resize?: boolean;
|
|
205
|
-
}): this;
|
|
206
|
-
getForm(): Form;
|
|
207
|
-
set autoResize(auto: boolean);
|
|
208
|
-
get autoResize(): boolean;
|
|
209
|
-
resize(b: Bound, evt?: Event): this;
|
|
210
|
-
protected _resizeHandler(evt: Event): void;
|
|
211
|
-
get element(): Element;
|
|
212
|
-
get parent(): Element;
|
|
213
|
-
get ready(): boolean;
|
|
214
|
-
clear(bg?: string): this;
|
|
215
|
-
set background(bg: string);
|
|
216
|
-
get background(): string;
|
|
217
|
-
style(key: string, val: string, update?: boolean): this;
|
|
218
|
-
styles(styles: object, update?: boolean): this;
|
|
219
|
-
static setAttr(elem: Element, data: object): Element;
|
|
220
|
-
static getInlineStyles(data: object): string;
|
|
221
|
-
dispose(): this;
|
|
222
|
-
}
|
|
223
|
-
export class HTMLSpace extends DOMSpace {
|
|
224
|
-
getForm(): Form;
|
|
225
|
-
static htmlElement(parent: Element, name: string, id?: string, autoClass?: boolean): HTMLElement;
|
|
226
|
-
remove(player: IPlayer): this;
|
|
227
|
-
removeAll(): this;
|
|
115
|
+
interface ISpacePlayers {
|
|
116
|
+
[key: string]: IPlayer;
|
|
228
117
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
"border-color": string;
|
|
235
|
-
color: string;
|
|
236
|
-
"border-width": string;
|
|
237
|
-
"border-radius": string;
|
|
238
|
-
"border-style": string;
|
|
239
|
-
opacity: number;
|
|
240
|
-
position: string;
|
|
241
|
-
top: number;
|
|
242
|
-
left: number;
|
|
243
|
-
width: number;
|
|
244
|
-
height: number;
|
|
245
|
-
};
|
|
246
|
-
protected _ctx: DOMFormContext;
|
|
247
|
-
static groupID: number;
|
|
248
|
-
static domID: number;
|
|
249
|
-
protected _space: HTMLSpace;
|
|
250
|
-
protected _ready: boolean;
|
|
251
|
-
constructor(space: HTMLSpace);
|
|
252
|
-
get space(): HTMLSpace;
|
|
253
|
-
protected styleTo(k: any, v: any, unit?: string): void;
|
|
254
|
-
alpha(a: number): this;
|
|
255
|
-
fill(c: string | boolean): this;
|
|
256
|
-
stroke(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
257
|
-
fillText(c: string): this;
|
|
258
|
-
cls(c: string | boolean): this;
|
|
259
|
-
font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
260
|
-
reset(): this;
|
|
261
|
-
updateScope(group_id: string, group?: Element): object;
|
|
262
|
-
scope(item: IPlayer): object;
|
|
263
|
-
nextID(): string;
|
|
264
|
-
static getID(ctx: any): string;
|
|
265
|
-
static scopeID(item: IPlayer): string;
|
|
266
|
-
static style(elem: Element, styles: object): Element;
|
|
267
|
-
static rectStyle(ctx: DOMFormContext, pt: PtLike, size: PtLike): DOMFormContext;
|
|
268
|
-
static textStyle(ctx: DOMFormContext, pt: PtLike): DOMFormContext;
|
|
269
|
-
static point(ctx: DOMFormContext, pt: PtLike, radius?: number, shape?: string): Element;
|
|
270
|
-
point(pt: PtLike, radius?: number, shape?: string): this;
|
|
271
|
-
static circle(ctx: DOMFormContext, pt: PtLike, radius?: number): Element;
|
|
272
|
-
circle(pts: GroupLike | number[][]): this;
|
|
273
|
-
static square(ctx: DOMFormContext, pt: PtLike, halfsize: number): HTMLElement;
|
|
274
|
-
square(pt: PtLike, halfsize: number): this;
|
|
275
|
-
static rect(ctx: DOMFormContext, pts: PtLikeIterable): Element;
|
|
276
|
-
rect(pts: PtLikeIterable): this;
|
|
277
|
-
static text(ctx: DOMFormContext, pt: PtLike, txt: string): Element;
|
|
278
|
-
text(pt: PtLike, txt: string): this;
|
|
279
|
-
log(txt: any): this;
|
|
280
|
-
arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
281
|
-
line(pts: GroupLike | number[][]): this;
|
|
282
|
-
polygon(pts: GroupLike | number[][]): this;
|
|
118
|
+
interface ITimer {
|
|
119
|
+
prev: number;
|
|
120
|
+
diff: number;
|
|
121
|
+
end: number;
|
|
122
|
+
min: number;
|
|
283
123
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
124
|
+
declare type TouchPointsKey = "touches" | "changedTouches" | "targetTouches";
|
|
125
|
+
interface MultiTouchElement {
|
|
126
|
+
addEventListener(evt: any, callback: Function): any;
|
|
127
|
+
removeEventListener(evt: any, callback: Function): any;
|
|
288
128
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
get stroked(): boolean;
|
|
296
|
-
set stroked(b: boolean);
|
|
297
|
-
get currentFont(): Font;
|
|
298
|
-
protected _multiple(groups: GroupLike[], shape: string, ...rest: any[]): this;
|
|
299
|
-
abstract reset(): this;
|
|
300
|
-
alpha(a: number): this;
|
|
301
|
-
fill(c: string | boolean): this;
|
|
302
|
-
fillOnly(c: string | boolean): this;
|
|
303
|
-
stroke(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
304
|
-
strokeOnly(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
305
|
-
abstract point(p: PtLike, radius: number, shape: string): this;
|
|
306
|
-
points(pts: GroupLike | number[][], radius: number, shape: string): this;
|
|
307
|
-
abstract circle(pts: GroupLike | number[][]): this;
|
|
308
|
-
circles(groups: GroupLike[]): this;
|
|
309
|
-
squares(groups: GroupLike[]): this;
|
|
310
|
-
abstract arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
311
|
-
abstract line(pts: GroupLike | number[][]): this;
|
|
312
|
-
lines(groups: GroupLike[]): this;
|
|
313
|
-
abstract polygon(pts: GroupLike | number[][]): this;
|
|
314
|
-
polygons(groups: GroupLike[]): this;
|
|
315
|
-
abstract rect(pts: number[][] | Pt[]): this;
|
|
316
|
-
rects(groups: GroupLike[]): this;
|
|
317
|
-
abstract text(pt: PtLike, txt: string, maxWidth?: number): this;
|
|
318
|
-
abstract font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
129
|
+
interface PtsCanvasRenderingContext2D extends CanvasRenderingContext2D {
|
|
130
|
+
webkitBackingStorePixelRatio?: number;
|
|
131
|
+
mozBackingStorePixelRatio?: number;
|
|
132
|
+
msBackingStorePixelRatio?: number;
|
|
133
|
+
oBackingStorePixelRatio?: number;
|
|
134
|
+
backingStorePixelRatio?: number;
|
|
319
135
|
}
|
|
320
|
-
|
|
136
|
+
declare type CanvasSpaceOptions = {
|
|
137
|
+
bgcolor?: string;
|
|
138
|
+
resize?: boolean;
|
|
139
|
+
retina?: boolean;
|
|
140
|
+
offscreen?: boolean;
|
|
141
|
+
pixelDensity?: number;
|
|
142
|
+
};
|
|
143
|
+
declare type ColorType = "rgb" | "hsl" | "hsb" | "lab" | "lch" | "luv" | "xyz";
|
|
144
|
+
declare type DelaunayShape = {
|
|
145
|
+
i: number;
|
|
146
|
+
j: number;
|
|
147
|
+
k: number;
|
|
148
|
+
triangle: GroupLike;
|
|
149
|
+
circle: Group;
|
|
150
|
+
};
|
|
151
|
+
declare type DelaunayMesh = {
|
|
152
|
+
[key: string]: DelaunayShape;
|
|
153
|
+
}[];
|
|
154
|
+
declare type DOMFormContext = {
|
|
155
|
+
group: Element;
|
|
156
|
+
groupID: string;
|
|
157
|
+
groupCount: number;
|
|
158
|
+
currentID: string;
|
|
159
|
+
currentClass?: string;
|
|
160
|
+
style: object;
|
|
161
|
+
};
|
|
162
|
+
declare type IntersectContext = {
|
|
163
|
+
which: number;
|
|
164
|
+
dist: number;
|
|
165
|
+
normal: Pt;
|
|
166
|
+
vertex: Pt;
|
|
167
|
+
edge: Group;
|
|
168
|
+
other?: any;
|
|
169
|
+
};
|
|
170
|
+
declare type UIHandler = (target: UI, pt: PtLike, type: string, evt: MouseEvent) => void;
|
|
171
|
+
declare type WarningType = "error" | "warn" | "mute";
|
|
172
|
+
declare type ITempoStartFn = (count: number) => void | boolean;
|
|
173
|
+
declare type ITempoProgressFn = (count: number, t: number, ms: number, start: boolean) => void | boolean;
|
|
174
|
+
declare type ITempoListener = {
|
|
175
|
+
name?: string;
|
|
176
|
+
beats?: number | number[];
|
|
177
|
+
period?: number;
|
|
178
|
+
duration?: number;
|
|
179
|
+
offset?: number;
|
|
180
|
+
continuous?: boolean;
|
|
181
|
+
index?: number;
|
|
182
|
+
fn: Function;
|
|
183
|
+
};
|
|
184
|
+
declare type ITempoResponses = {
|
|
185
|
+
start: (fn: ITempoStartFn, offset: number, name?: string) => string;
|
|
186
|
+
progress: (fn: ITempoProgressFn, offset: number, name?: string) => string;
|
|
187
|
+
};
|
|
188
|
+
declare type ISoundAnalyzer = {
|
|
189
|
+
node: AnalyserNode;
|
|
321
190
|
size: number;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
191
|
+
data: Uint8Array;
|
|
192
|
+
};
|
|
193
|
+
declare type SoundType = "file" | "gen" | "input";
|
|
194
|
+
declare type DefaultFormStyle = {
|
|
195
|
+
fillStyle?: string | CanvasGradient | CanvasPattern;
|
|
196
|
+
strokeStyle?: string | CanvasGradient | CanvasPattern;
|
|
197
|
+
lineWidth?: number;
|
|
198
|
+
lineJoin?: string;
|
|
199
|
+
lineCap?: string;
|
|
200
|
+
globalAlpha?: number;
|
|
201
|
+
};
|
|
202
|
+
declare type CanvasPatternRepetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
|
330
203
|
|
|
331
|
-
|
|
332
|
-
protected _img: HTMLImageElement;
|
|
333
|
-
protected _data: ImageData;
|
|
334
|
-
protected _cv: HTMLCanvasElement;
|
|
335
|
-
protected _ctx: CanvasRenderingContext2D;
|
|
336
|
-
protected _scale: number;
|
|
337
|
-
protected _loaded: boolean;
|
|
338
|
-
protected _editable: boolean;
|
|
339
|
-
protected _space: CanvasSpace;
|
|
340
|
-
constructor(editable?: boolean, space?: CanvasSpace, crossOrigin?: boolean);
|
|
341
|
-
static load(src: string, editable?: boolean, space?: CanvasSpace, ready?: (img: any) => {}): Img;
|
|
342
|
-
static loadAsync(src: string, editable?: boolean, space?: CanvasSpace): Promise<Img>;
|
|
343
|
-
static loadPattern(src: string, space: CanvasSpace, repeat?: CanvasPatternRepetition, editable?: boolean): Promise<CanvasPattern>;
|
|
344
|
-
static blank(size: PtLike, space: CanvasSpace, scale?: number): Img;
|
|
345
|
-
load(src: string): Promise<Img>;
|
|
346
|
-
protected _drawToScale(canvasScale: number | PtLike, img: CanvasImageSource): void;
|
|
347
|
-
initCanvas(width: number, height: number, canvasScale?: number | PtLike): void;
|
|
348
|
-
bitmap(size?: PtLike): Promise<ImageBitmap>;
|
|
349
|
-
pattern(reptition?: CanvasPatternRepetition, dynamic?: boolean): CanvasPattern;
|
|
350
|
-
sync(): void;
|
|
351
|
-
pixel(p: PtLike, rescale?: boolean | number): Pt;
|
|
352
|
-
static getPixel(imgData: ImageData, p: PtLike): Pt;
|
|
353
|
-
resize(sizeOrScale: PtLike, asScale?: boolean): this;
|
|
354
|
-
crop(box: Bound): ImageData;
|
|
355
|
-
filter(css: string): this;
|
|
356
|
-
cleanup(): void;
|
|
357
|
-
static fromBlob(blob: Blob, editable?: boolean, space?: CanvasSpace): Promise<Img>;
|
|
358
|
-
static imageDataToBlob(data: ImageData): Promise<Blob>;
|
|
359
|
-
toBase64(): string;
|
|
360
|
-
toBlob(): Promise<Blob>;
|
|
361
|
-
getForm(): CanvasForm;
|
|
362
|
-
get current(): CanvasImageSource;
|
|
363
|
-
get image(): HTMLImageElement;
|
|
364
|
-
get canvas(): HTMLCanvasElement;
|
|
365
|
-
get data(): ImageData;
|
|
366
|
-
get ctx(): CanvasRenderingContext2D;
|
|
367
|
-
get loaded(): boolean;
|
|
368
|
-
get pixelScale(): number;
|
|
369
|
-
get imageSize(): Pt;
|
|
370
|
-
get canvasSize(): Pt;
|
|
371
|
-
get scaledMatrix(): Mat;
|
|
372
|
-
}
|
|
204
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
373
205
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
static
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
export class Num {
|
|
427
|
-
static generator: any;
|
|
428
|
-
static equals(a: number, b: number, threshold?: number): boolean;
|
|
429
|
-
static lerp(a: number, b: number, t: number): number;
|
|
430
|
-
static clamp(val: number, min: number, max: number): number;
|
|
431
|
-
static boundValue(val: number, min: number, max: number): number;
|
|
432
|
-
static within(p: number, a: number, b: number): boolean;
|
|
433
|
-
static randomRange(a: number, b?: number): number;
|
|
434
|
-
static randomPt(a: PtLike, b?: PtLike): Pt;
|
|
435
|
-
static normalizeValue(n: number, a: number, b: number): number;
|
|
436
|
-
static sum(pts: PtLikeIterable): Pt;
|
|
437
|
-
static average(pts: PtLikeIterable): Pt;
|
|
438
|
-
static cycle(t: number, method?: (t: number) => number): number;
|
|
439
|
-
static mapToRange(n: number, currA: number, currB: number, targetA: number, targetB: number): number;
|
|
440
|
-
static seed(seed: string): void;
|
|
441
|
-
static random(): number;
|
|
442
|
-
}
|
|
443
|
-
export class Geom {
|
|
444
|
-
static boundAngle(angle: number): number;
|
|
445
|
-
static boundRadian(radian: number): number;
|
|
446
|
-
static toRadian(angle: number): number;
|
|
447
|
-
static toDegree(radian: number): number;
|
|
448
|
-
static boundingBox(pts: PtIterable): Group;
|
|
449
|
-
static centroid(pts: PtLikeIterable): Pt;
|
|
450
|
-
static anchor(pts: PtLikeIterable, ptOrIndex?: PtLike | number, direction?: ("to" | "from")): void;
|
|
451
|
-
static interpolate(a: PtLike, b: PtLike, t?: number): Pt;
|
|
452
|
-
static perpendicular(pt: PtLike, axis?: string | PtLike): Group;
|
|
453
|
-
static isPerpendicular(p1: PtLike, p2: PtLike): boolean;
|
|
454
|
-
static withinBound(pt: PtLike, boundPt1: PtLike, boundPt2: PtLike): boolean;
|
|
455
|
-
static sortEdges(pts: PtIterable): GroupLike;
|
|
456
|
-
static scale(ps: Pt | PtIterable, scale: number | PtLike, anchor?: PtLike): Geom;
|
|
457
|
-
static rotate2D(ps: Pt | PtIterable, angle: number, anchor?: PtLike, axis?: string | PtLike): Geom;
|
|
458
|
-
static shear2D(ps: Pt | PtIterable, scale: number | PtLike, anchor?: PtLike, axis?: string | PtLike): Geom;
|
|
459
|
-
static reflect2D(ps: Pt | PtIterable, line: PtLikeIterable, axis?: string | PtLike): Geom;
|
|
460
|
-
static cosTable(): {
|
|
461
|
-
table: Float64Array;
|
|
462
|
-
cos: (rad: number) => number;
|
|
206
|
+
declare class Pt extends Float32Array implements IPt, Iterable<number> {
|
|
207
|
+
protected _id: string;
|
|
208
|
+
constructor(...args: any[]);
|
|
209
|
+
static make(dimensions: number, defaultValue?: number, randomize?: boolean): Pt;
|
|
210
|
+
get id(): string;
|
|
211
|
+
set id(s: string);
|
|
212
|
+
get x(): number;
|
|
213
|
+
set x(n: number);
|
|
214
|
+
get y(): number;
|
|
215
|
+
set y(n: number);
|
|
216
|
+
get z(): number;
|
|
217
|
+
set z(n: number);
|
|
218
|
+
get w(): number;
|
|
219
|
+
set w(n: number);
|
|
220
|
+
clone(): Pt;
|
|
221
|
+
equals(p: PtLike, threshold?: number): boolean;
|
|
222
|
+
to(...args: any[]): this;
|
|
223
|
+
$to(...args: any[]): Pt;
|
|
224
|
+
toAngle(radian: number, magnitude?: number, anchorFromPt?: boolean): this;
|
|
225
|
+
op(fn: (p1: PtLike, ...rest: any[]) => any): (...rest: any[]) => any;
|
|
226
|
+
ops(fns: ((p1: PtLike, ...rest: any[]) => any)[]): ((...rest: any[]) => any)[];
|
|
227
|
+
$take(axis: string | number[]): Pt;
|
|
228
|
+
$concat(...args: any[]): Pt;
|
|
229
|
+
add(...args: any[]): this;
|
|
230
|
+
$add(...args: any[]): Pt;
|
|
231
|
+
subtract(...args: any[]): this;
|
|
232
|
+
$subtract(...args: any[]): Pt;
|
|
233
|
+
multiply(...args: any[]): this;
|
|
234
|
+
$multiply(...args: any[]): Pt;
|
|
235
|
+
divide(...args: any[]): this;
|
|
236
|
+
$divide(...args: any[]): Pt;
|
|
237
|
+
magnitudeSq(): number;
|
|
238
|
+
magnitude(): number;
|
|
239
|
+
unit(magnitude?: number): Pt;
|
|
240
|
+
$unit(magnitude?: number): Pt;
|
|
241
|
+
dot(...args: any[]): number;
|
|
242
|
+
$cross2D(...args: any[]): number;
|
|
243
|
+
$cross(...args: any[]): Pt;
|
|
244
|
+
$project(...args: any[]): Pt;
|
|
245
|
+
projectScalar(...args: any[]): number;
|
|
246
|
+
abs(): Pt;
|
|
247
|
+
$abs(): Pt;
|
|
248
|
+
floor(): Pt;
|
|
249
|
+
$floor(): Pt;
|
|
250
|
+
ceil(): Pt;
|
|
251
|
+
$ceil(): Pt;
|
|
252
|
+
round(): Pt;
|
|
253
|
+
$round(): Pt;
|
|
254
|
+
minValue(): {
|
|
255
|
+
value: number;
|
|
256
|
+
index: number;
|
|
463
257
|
};
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
258
|
+
maxValue(): {
|
|
259
|
+
value: number;
|
|
260
|
+
index: number;
|
|
467
261
|
};
|
|
262
|
+
$min(...args: any[]): Pt;
|
|
263
|
+
$max(...args: any[]): Pt;
|
|
264
|
+
angle(axis?: string | number[]): number;
|
|
265
|
+
angleBetween(p: Pt, axis?: string | number[]): number;
|
|
266
|
+
scale(scale: number | number[] | PtLike, anchor?: PtLike): this;
|
|
267
|
+
rotate2D(angle: number, anchor?: PtLike, axis?: string): this;
|
|
268
|
+
shear2D(scale: number | number[] | PtLike, anchor?: PtLike, axis?: string): this;
|
|
269
|
+
reflect2D(line: GroupLike, axis?: string): this;
|
|
270
|
+
toString(): string;
|
|
271
|
+
toArray(): number[];
|
|
272
|
+
toGroup(): Group;
|
|
273
|
+
toBound(): Bound;
|
|
468
274
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
static
|
|
484
|
-
static
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
275
|
+
declare class Group extends Array<Pt> {
|
|
276
|
+
protected _id: string;
|
|
277
|
+
constructor(...args: Pt[]);
|
|
278
|
+
get id(): string;
|
|
279
|
+
set id(s: string);
|
|
280
|
+
get p1(): Pt;
|
|
281
|
+
get p2(): Pt;
|
|
282
|
+
get p3(): Pt;
|
|
283
|
+
get p4(): Pt;
|
|
284
|
+
get q1(): Pt;
|
|
285
|
+
get q2(): Pt;
|
|
286
|
+
get q3(): Pt;
|
|
287
|
+
get q4(): Pt;
|
|
288
|
+
clone(): Group;
|
|
289
|
+
static fromArray(list: PtLikeIterable): Group;
|
|
290
|
+
static fromPtArray(list: PtIterable): Group;
|
|
291
|
+
split(chunkSize: number, stride?: number, loopBack?: boolean): Group[];
|
|
292
|
+
insert(pts: PtIterable, index?: number): this;
|
|
293
|
+
remove(index?: number, count?: number): Group;
|
|
294
|
+
segments(pts_per_segment?: number, stride?: number, loopBack?: boolean): Group[];
|
|
295
|
+
lines(): Group[];
|
|
296
|
+
centroid(): Pt;
|
|
297
|
+
boundingBox(): Group;
|
|
298
|
+
anchorTo(ptOrIndex?: PtLike | number): void;
|
|
299
|
+
anchorFrom(ptOrIndex?: PtLike | number): void;
|
|
300
|
+
op(fn: (g1: PtIterable, ...rest: any[]) => any): (...rest: any[]) => any;
|
|
301
|
+
ops(fns: ((g1: PtIterable, ...rest: any[]) => any)[]): ((...rest: any[]) => any)[];
|
|
302
|
+
interpolate(t: number): Pt;
|
|
303
|
+
moveBy(...args: any[]): this;
|
|
304
|
+
moveTo(...args: any[]): this;
|
|
305
|
+
scale(scale: number | number[] | PtLike, anchor?: PtLike): this;
|
|
306
|
+
rotate2D(angle: number, anchor?: PtLike, axis?: string): this;
|
|
307
|
+
shear2D(scale: number | number[] | PtLike, anchor?: PtLike, axis?: string): this;
|
|
308
|
+
reflect2D(line: PtLikeIterable, axis?: string): this;
|
|
309
|
+
sortByDimension(dim: number, desc?: boolean): this;
|
|
310
|
+
forEachPt(ptFn: string, ...args: any[]): this;
|
|
311
|
+
add(...args: any[]): this;
|
|
312
|
+
subtract(...args: any[]): this;
|
|
313
|
+
multiply(...args: any[]): this;
|
|
314
|
+
divide(...args: any[]): this;
|
|
315
|
+
$matrixAdd(g: GroupLike | number[][] | number): Group;
|
|
316
|
+
$matrixMultiply(g: GroupLike | number, transposed?: boolean, elementwise?: boolean): Group;
|
|
317
|
+
zipSlice(index: number, defaultValue?: number | boolean): Pt;
|
|
318
|
+
$zip(defaultValue?: number | boolean, useLongest?: boolean): Group;
|
|
319
|
+
toBound(): Group;
|
|
320
|
+
toString(): string;
|
|
500
321
|
}
|
|
501
|
-
|
|
502
|
-
protected
|
|
503
|
-
protected
|
|
504
|
-
protected
|
|
505
|
-
protected
|
|
506
|
-
protected
|
|
507
|
-
constructor(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
322
|
+
declare class Bound extends Group implements IPt {
|
|
323
|
+
protected _center: Pt;
|
|
324
|
+
protected _size: Pt;
|
|
325
|
+
protected _topLeft: Pt;
|
|
326
|
+
protected _bottomRight: Pt;
|
|
327
|
+
protected _inited: boolean;
|
|
328
|
+
constructor(...args: Pt[]);
|
|
329
|
+
static fromBoundingRect(rect: ClientRect): Bound;
|
|
330
|
+
static fromGroup(g: PtLikeIterable): Bound;
|
|
331
|
+
protected init(): void;
|
|
332
|
+
clone(): Bound;
|
|
333
|
+
protected _updateSize(): void;
|
|
334
|
+
protected _updateCenter(): void;
|
|
335
|
+
protected _updatePosFromTop(): void;
|
|
336
|
+
protected _updatePosFromBottom(): void;
|
|
337
|
+
protected _updatePosFromCenter(): void;
|
|
338
|
+
get size(): Pt;
|
|
339
|
+
set size(p: Pt);
|
|
340
|
+
get center(): Pt;
|
|
341
|
+
set center(p: Pt);
|
|
342
|
+
get topLeft(): Pt;
|
|
343
|
+
set topLeft(p: Pt);
|
|
344
|
+
get bottomRight(): Pt;
|
|
345
|
+
set bottomRight(p: Pt);
|
|
346
|
+
get width(): number;
|
|
347
|
+
set width(w: number);
|
|
348
|
+
get height(): number;
|
|
349
|
+
set height(h: number);
|
|
350
|
+
get depth(): number;
|
|
351
|
+
set depth(d: number);
|
|
352
|
+
get x(): number;
|
|
353
|
+
get y(): number;
|
|
354
|
+
get z(): number;
|
|
355
|
+
get inited(): boolean;
|
|
356
|
+
update(): this;
|
|
515
357
|
}
|
|
516
358
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
xi: number;
|
|
523
|
-
yi: number;
|
|
524
|
-
};
|
|
525
|
-
static sideOfPt2D(line: PtLikeIterable, pt: PtLike): number;
|
|
526
|
-
static collinear(p1: PtLike, p2: PtLike, p3: PtLike, threshold?: number): boolean;
|
|
527
|
-
static magnitude(line: PtIterable): number;
|
|
528
|
-
static magnitudeSq(line: PtIterable): number;
|
|
529
|
-
static perpendicularFromPt(line: PtIterable, pt: PtLike, asProjection?: boolean): Pt;
|
|
530
|
-
static distanceFromPt(line: GroupLike, pt: PtLike | number[]): number;
|
|
531
|
-
static intersectRay2D(la: PtIterable, lb: PtIterable): Pt;
|
|
532
|
-
static intersectLine2D(la: PtIterable, lb: PtIterable): Pt;
|
|
533
|
-
static intersectLineWithRay2D(line: PtIterable, ray: PtIterable): Pt;
|
|
534
|
-
static intersectPolygon2D(lineOrRay: PtIterable, poly: PtIterable, sourceIsRay?: boolean): Group;
|
|
535
|
-
static intersectLines2D(lines1: Iterable<PtIterable>, lines2: Iterable<PtIterable>, isRay?: boolean): Group;
|
|
536
|
-
static intersectGridWithRay2D(ray: PtIterable, gridPt: PtLike): Group;
|
|
537
|
-
static intersectGridWithLine2D(line: GroupLike, gridPt: PtLike | number[]): Group;
|
|
538
|
-
static intersectRect2D(line: GroupLike, rect: GroupLike): Group;
|
|
539
|
-
static subpoints(line: PtLikeIterable, num: number): Group;
|
|
540
|
-
static crop(line: PtIterable, size: PtLike, index?: number, cropAsCircle?: boolean): Pt;
|
|
541
|
-
static marker(line: PtIterable, size: PtLike, graphic?: string, atTail?: boolean): Group;
|
|
542
|
-
static toRect(line: GroupLike): Group;
|
|
359
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
360
|
+
|
|
361
|
+
declare abstract class Form {
|
|
362
|
+
protected _ready: boolean;
|
|
363
|
+
get ready(): boolean;
|
|
543
364
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
365
|
+
declare abstract class VisualForm extends Form {
|
|
366
|
+
protected _filled: boolean;
|
|
367
|
+
protected _stroked: boolean;
|
|
368
|
+
protected _font: Font;
|
|
369
|
+
get filled(): boolean;
|
|
370
|
+
set filled(b: boolean);
|
|
371
|
+
get stroked(): boolean;
|
|
372
|
+
set stroked(b: boolean);
|
|
373
|
+
get currentFont(): Font;
|
|
374
|
+
protected _multiple(groups: GroupLike[], shape: string, ...rest: any[]): this;
|
|
375
|
+
abstract reset(): this;
|
|
376
|
+
alpha(a: number): this;
|
|
377
|
+
fill(c: string | boolean): this;
|
|
378
|
+
fillOnly(c: string | boolean): this;
|
|
379
|
+
stroke(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
380
|
+
strokeOnly(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
381
|
+
abstract point(p: PtLike, radius: number, shape: string): this;
|
|
382
|
+
points(pts: GroupLike | number[][], radius: number, shape: string): this;
|
|
383
|
+
abstract circle(pts: GroupLike | number[][]): this;
|
|
384
|
+
circles(groups: GroupLike[]): this;
|
|
385
|
+
squares(groups: GroupLike[]): this;
|
|
386
|
+
abstract arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
387
|
+
abstract line(pts: GroupLike | number[][]): this;
|
|
388
|
+
lines(groups: GroupLike[]): this;
|
|
389
|
+
abstract polygon(pts: GroupLike | number[][]): this;
|
|
390
|
+
polygons(groups: GroupLike[]): this;
|
|
391
|
+
abstract rect(pts: number[][] | Pt[]): this;
|
|
392
|
+
rects(groups: GroupLike[]): this;
|
|
393
|
+
abstract text(pt: PtLike, txt: string, maxWidth?: number): this;
|
|
394
|
+
abstract font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
561
395
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
static toRect(circle: PtIterable, within?: boolean): Group;
|
|
572
|
-
static toTriangle(circle: PtIterable, within?: boolean): Group;
|
|
396
|
+
declare class Font {
|
|
397
|
+
size: number;
|
|
398
|
+
lineHeight: number;
|
|
399
|
+
face: string;
|
|
400
|
+
style: string;
|
|
401
|
+
weight: string;
|
|
402
|
+
constructor(size?: number, face?: string, weight?: string, style?: string, lineHeight?: number);
|
|
403
|
+
get value(): string;
|
|
404
|
+
toString(): string;
|
|
573
405
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
406
|
+
|
|
407
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
408
|
+
|
|
409
|
+
declare abstract class Space {
|
|
410
|
+
id: string;
|
|
411
|
+
protected bound: Bound;
|
|
412
|
+
protected _time: ITimer;
|
|
413
|
+
protected players: ISpacePlayers;
|
|
414
|
+
protected playerCount: number;
|
|
415
|
+
protected _ctx: any;
|
|
416
|
+
private _animID;
|
|
417
|
+
private _pause;
|
|
418
|
+
private _refresh;
|
|
419
|
+
private _renderFunc;
|
|
420
|
+
protected _pointer: Pt;
|
|
421
|
+
protected _isReady: boolean;
|
|
422
|
+
protected _playing: boolean;
|
|
423
|
+
protected _keyDownBind: (evt: KeyboardEvent) => boolean;
|
|
424
|
+
protected _keyUpBind: (evt: KeyboardEvent) => boolean;
|
|
425
|
+
refresh(b: boolean): this;
|
|
426
|
+
minFrameTime(ms?: number): void;
|
|
427
|
+
add(p: IPlayer | AnimateCallbackFn): this;
|
|
428
|
+
remove(player: IPlayer): this;
|
|
429
|
+
removeAll(): this;
|
|
430
|
+
play(time?: number): this;
|
|
431
|
+
replay(): void;
|
|
432
|
+
protected playItems(time: number): void;
|
|
433
|
+
pause(toggle?: boolean): this;
|
|
434
|
+
resume(): this;
|
|
435
|
+
stop(t?: number): this;
|
|
436
|
+
playOnce(duration?: number): this;
|
|
437
|
+
protected render(context: any): this;
|
|
438
|
+
set customRendering(f: (context: any, self: Space) => null);
|
|
439
|
+
get customRendering(): (context: any, self: Space) => null;
|
|
440
|
+
get isPlaying(): boolean;
|
|
441
|
+
get outerBound(): Bound;
|
|
442
|
+
get innerBound(): Bound;
|
|
443
|
+
get size(): Pt;
|
|
444
|
+
get center(): Pt;
|
|
445
|
+
get width(): number;
|
|
446
|
+
get height(): number;
|
|
447
|
+
abstract resize(b: Bound, evt?: Event): this;
|
|
448
|
+
abstract clear(): this;
|
|
449
|
+
abstract getForm(): Form;
|
|
586
450
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
451
|
+
declare abstract class MultiTouchSpace extends Space {
|
|
452
|
+
protected _pressed: boolean;
|
|
453
|
+
protected _dragged: boolean;
|
|
454
|
+
protected _hasMouse: boolean;
|
|
455
|
+
protected _hasTouch: boolean;
|
|
456
|
+
protected _hasKeyboard: boolean;
|
|
457
|
+
protected _canvas: EventTarget;
|
|
458
|
+
get pointer(): Pt;
|
|
459
|
+
bindCanvas(evt: string, callback: EventListener, options?: any, customTarget?: Element): void;
|
|
460
|
+
unbindCanvas(evt: string, callback: EventListener, options?: any, customTarget?: Element): void;
|
|
461
|
+
bindDoc(evt: string, callback: EventListener, options?: any): void;
|
|
462
|
+
unbindDoc(evt: string, callback: EventListener, options?: any): void;
|
|
463
|
+
bindMouse(bind?: boolean, customTarget?: Element): this;
|
|
464
|
+
bindTouch(bind?: boolean, passive?: boolean, customTarget?: Element): this;
|
|
465
|
+
bindKeyboard(bind?: boolean): this;
|
|
466
|
+
touchesToPoints(evt: TouchEvent, which?: TouchPointsKey): Pt[];
|
|
467
|
+
protected _mouseAction(type: string, evt: MouseEvent | TouchEvent): void;
|
|
468
|
+
protected _mouseDown(evt: MouseEvent | TouchEvent): boolean;
|
|
469
|
+
protected _mouseUp(evt: MouseEvent | TouchEvent): boolean;
|
|
470
|
+
protected _mouseMove(evt: MouseEvent | TouchEvent): boolean;
|
|
471
|
+
protected _mouseOver(evt: MouseEvent | TouchEvent): boolean;
|
|
472
|
+
protected _mouseOut(evt: MouseEvent | TouchEvent): boolean;
|
|
473
|
+
protected _mouseClick(evt: MouseEvent | TouchEvent): boolean;
|
|
474
|
+
protected _contextMenu(evt: MouseEvent): boolean;
|
|
475
|
+
protected _touchMove(evt: TouchEvent): boolean;
|
|
476
|
+
protected _touchStart(evt: TouchEvent): boolean;
|
|
477
|
+
protected _keyDown(evt: KeyboardEvent): boolean;
|
|
478
|
+
protected _keyUp(evt: KeyboardEvent): boolean;
|
|
479
|
+
protected _keyboardAction(type: string, evt: KeyboardEvent): void;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
483
|
+
|
|
484
|
+
declare class Vec {
|
|
485
|
+
static add(a: PtLike, b: PtLike | number): PtLike;
|
|
486
|
+
static subtract(a: PtLike, b: PtLike | number): PtLike;
|
|
487
|
+
static multiply(a: PtLike, b: PtLike | number): PtLike;
|
|
488
|
+
static divide(a: PtLike, b: PtLike | number): PtLike;
|
|
489
|
+
static dot(a: PtLike, b: PtLike): number;
|
|
490
|
+
static cross2D(a: PtLike, b: PtLike): number;
|
|
491
|
+
static cross(a: PtLike, b: PtLike): Pt;
|
|
492
|
+
static magnitude(a: PtLike): number;
|
|
493
|
+
static unit(a: PtLike, magnitude?: number): PtLike;
|
|
494
|
+
static abs(a: PtLike): PtLike;
|
|
495
|
+
static floor(a: PtLike): PtLike;
|
|
496
|
+
static ceil(a: PtLike): PtLike;
|
|
497
|
+
static round(a: PtLike): PtLike;
|
|
498
|
+
static max(a: PtLike): {
|
|
499
|
+
value: any;
|
|
500
|
+
index: any;
|
|
599
501
|
};
|
|
600
|
-
static
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
static
|
|
605
|
-
|
|
606
|
-
static hasIntersectPoint(poly: PtLikeIterable, pt: PtLike): boolean;
|
|
607
|
-
static hasIntersectCircle(poly: PtIterable, circle: PtIterable): IntersectContext;
|
|
608
|
-
static hasIntersectPolygon(poly1: PtIterable, poly2: PtIterable): IntersectContext;
|
|
609
|
-
static intersectPolygon2D(poly1: PtIterable, poly2: PtIterable): Group;
|
|
610
|
-
static toRects(polys: Iterable<PtIterable>): Group[];
|
|
502
|
+
static min(a: PtLike): {
|
|
503
|
+
value: any;
|
|
504
|
+
index: any;
|
|
505
|
+
};
|
|
506
|
+
static sum(a: PtLike): number;
|
|
507
|
+
static map(a: PtLike, fn: (n: number, index: number, arr: any) => number): PtLike;
|
|
611
508
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
static
|
|
623
|
-
static
|
|
624
|
-
static
|
|
509
|
+
declare class Mat {
|
|
510
|
+
protected _33: GroupLike;
|
|
511
|
+
constructor();
|
|
512
|
+
get value(): GroupLike;
|
|
513
|
+
get domMatrix(): DOMMatrix;
|
|
514
|
+
reset(): void;
|
|
515
|
+
scale2D(val: PtLike, at?: PtLike): this;
|
|
516
|
+
rotate2D(ang: number, at?: PtLike): this;
|
|
517
|
+
translate2D(val: PtLike): this;
|
|
518
|
+
shear2D(val: PtLike, at?: PtLike): this;
|
|
519
|
+
static add(a: GroupLike, b: GroupLike | number[][] | number): Group;
|
|
520
|
+
static multiply(a: GroupLike, b: GroupLike | number[][] | number, transposed?: boolean, elementwise?: boolean): Group;
|
|
521
|
+
static zipSlice(g: GroupLike | number[][], index: number, defaultValue?: number | boolean): Pt;
|
|
522
|
+
static zip(g: GroupLike | number[][], defaultValue?: number | boolean, useLongest?: boolean): Group;
|
|
523
|
+
static transpose(g: GroupLike | number[][], defaultValue?: number | boolean, useLongest?: boolean): Group;
|
|
524
|
+
static toDOMMatrix(m: GroupLike | number[][]): number[];
|
|
525
|
+
static transform2D(pt: PtLike, m: GroupLike | number[][]): Pt;
|
|
526
|
+
static scale2DMatrix(x: number, y: number): GroupLike;
|
|
527
|
+
static rotate2DMatrix(cosA: number, sinA: number): GroupLike;
|
|
528
|
+
static shear2DMatrix(tanX: number, tanY: number): GroupLike;
|
|
529
|
+
static translate2DMatrix(x: number, y: number): GroupLike;
|
|
530
|
+
static scaleAt2DMatrix(sx: number, sy: number, at: PtLike): GroupLike;
|
|
531
|
+
static rotateAt2DMatrix(cosA: number, sinA: number, at: PtLike): GroupLike;
|
|
532
|
+
static shearAt2DMatrix(tanX: number, tanY: number, at: PtLike): GroupLike;
|
|
533
|
+
static reflectAt2DMatrix(p1: PtLike, p2: PtLike): Pt[];
|
|
625
534
|
}
|
|
626
535
|
|
|
627
|
-
|
|
628
|
-
protected
|
|
629
|
-
protected
|
|
630
|
-
protected
|
|
631
|
-
protected
|
|
632
|
-
protected
|
|
633
|
-
protected
|
|
634
|
-
protected
|
|
635
|
-
protected
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
536
|
+
declare class Img {
|
|
537
|
+
protected _img: HTMLImageElement;
|
|
538
|
+
protected _data: ImageData;
|
|
539
|
+
protected _cv: HTMLCanvasElement;
|
|
540
|
+
protected _ctx: CanvasRenderingContext2D;
|
|
541
|
+
protected _scale: number;
|
|
542
|
+
protected _loaded: boolean;
|
|
543
|
+
protected _editable: boolean;
|
|
544
|
+
protected _space: CanvasSpace;
|
|
545
|
+
constructor(editable?: boolean, space?: CanvasSpace, crossOrigin?: boolean);
|
|
546
|
+
static load(src: string, editable?: boolean, space?: CanvasSpace, ready?: (img: any) => {}): Img;
|
|
547
|
+
static loadAsync(src: string, editable?: boolean, space?: CanvasSpace): Promise<Img>;
|
|
548
|
+
static loadPattern(src: string, space: CanvasSpace, repeat?: CanvasPatternRepetition, editable?: boolean): Promise<CanvasPattern>;
|
|
549
|
+
static blank(size: PtLike, space: CanvasSpace, scale?: number): Img;
|
|
550
|
+
load(src: string): Promise<Img>;
|
|
551
|
+
protected _drawToScale(canvasScale: number | PtLike, img: CanvasImageSource): void;
|
|
552
|
+
initCanvas(width: number, height: number, canvasScale?: number | PtLike): void;
|
|
553
|
+
bitmap(size?: PtLike): Promise<ImageBitmap>;
|
|
554
|
+
pattern(reptition?: CanvasPatternRepetition, dynamic?: boolean): CanvasPattern;
|
|
555
|
+
sync(): void;
|
|
556
|
+
pixel(p: PtLike, rescale?: boolean | number): Pt;
|
|
557
|
+
static getPixel(imgData: ImageData, p: PtLike): Pt;
|
|
558
|
+
resize(sizeOrScale: PtLike, asScale?: boolean): this;
|
|
559
|
+
crop(box: Bound): ImageData;
|
|
560
|
+
filter(css: string): this;
|
|
561
|
+
cleanup(): void;
|
|
562
|
+
static fromBlob(blob: Blob, editable?: boolean, space?: CanvasSpace): Promise<Img>;
|
|
563
|
+
static imageDataToBlob(data: ImageData): Promise<Blob>;
|
|
564
|
+
toBase64(): string;
|
|
565
|
+
toBlob(): Promise<Blob>;
|
|
566
|
+
getForm(): CanvasForm;
|
|
567
|
+
get current(): CanvasImageSource;
|
|
568
|
+
get image(): HTMLImageElement;
|
|
569
|
+
get canvas(): HTMLCanvasElement;
|
|
570
|
+
get data(): ImageData;
|
|
571
|
+
get ctx(): CanvasRenderingContext2D;
|
|
572
|
+
get loaded(): boolean;
|
|
573
|
+
get pixelScale(): number;
|
|
574
|
+
get imageSize(): Pt;
|
|
575
|
+
get canvasSize(): Pt;
|
|
576
|
+
get scaledMatrix(): Mat;
|
|
664
577
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
protected
|
|
670
|
-
protected
|
|
671
|
-
protected
|
|
672
|
-
protected
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
set
|
|
684
|
-
get
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
set
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
578
|
+
|
|
579
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
580
|
+
|
|
581
|
+
declare class CanvasSpace extends MultiTouchSpace {
|
|
582
|
+
protected _canvas: HTMLCanvasElement;
|
|
583
|
+
protected _container: Element;
|
|
584
|
+
protected _pixelScale: number;
|
|
585
|
+
protected _autoResize: boolean;
|
|
586
|
+
protected _bgcolor: string;
|
|
587
|
+
protected _ctx: PtsCanvasRenderingContext2D;
|
|
588
|
+
protected _offscreen: boolean;
|
|
589
|
+
protected _offCanvas: HTMLCanvasElement;
|
|
590
|
+
protected _offCtx: PtsCanvasRenderingContext2D;
|
|
591
|
+
protected _initialResize: boolean;
|
|
592
|
+
constructor(elem: string | Element, callback?: Function);
|
|
593
|
+
protected _createElement(elem: string, id: any): HTMLElement;
|
|
594
|
+
private _ready;
|
|
595
|
+
setup(opt: CanvasSpaceOptions): this;
|
|
596
|
+
set autoResize(auto: boolean);
|
|
597
|
+
get autoResize(): boolean;
|
|
598
|
+
resize(b: Bound, evt?: Event): this;
|
|
599
|
+
protected _resizeHandler(evt: Event): void;
|
|
600
|
+
set background(bg: string);
|
|
601
|
+
get background(): string;
|
|
602
|
+
get pixelScale(): number;
|
|
603
|
+
get hasOffscreen(): boolean;
|
|
604
|
+
get offscreenCtx(): PtsCanvasRenderingContext2D;
|
|
605
|
+
get offscreenCanvas(): HTMLCanvasElement;
|
|
606
|
+
getForm(): CanvasForm;
|
|
607
|
+
get element(): HTMLCanvasElement;
|
|
608
|
+
get parent(): Element;
|
|
609
|
+
get ready(): boolean;
|
|
610
|
+
get ctx(): PtsCanvasRenderingContext2D;
|
|
611
|
+
clear(bg?: string): this;
|
|
612
|
+
clearOffscreen(bg?: string): this;
|
|
613
|
+
protected playItems(time: number): void;
|
|
614
|
+
dispose(): this;
|
|
615
|
+
recorder(downloadOrCallback: boolean | ((blobURL: string) => {}), filetype?: string, bitrate?: number): MediaRecorder;
|
|
694
616
|
}
|
|
695
|
-
|
|
696
|
-
protected
|
|
697
|
-
protected
|
|
698
|
-
protected
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
617
|
+
declare class CanvasForm extends VisualForm {
|
|
618
|
+
protected _space: CanvasSpace;
|
|
619
|
+
protected _ctx: CanvasRenderingContext2D;
|
|
620
|
+
protected _estimateTextWidth: (string: any) => number;
|
|
621
|
+
protected _style: DefaultFormStyle;
|
|
622
|
+
constructor(space: CanvasSpace | CanvasRenderingContext2D);
|
|
623
|
+
get space(): CanvasSpace;
|
|
624
|
+
get ctx(): PtsCanvasRenderingContext2D;
|
|
625
|
+
useOffscreen(off?: boolean, clear?: boolean | string): this;
|
|
626
|
+
renderOffscreen(offset?: PtLike): void;
|
|
627
|
+
alpha(a: number): this;
|
|
628
|
+
fill(c: string | boolean | CanvasGradient | CanvasPattern): this;
|
|
629
|
+
stroke(c: string | boolean | CanvasGradient | CanvasPattern, width?: number, linejoin?: CanvasLineJoin, linecap?: CanvasLineCap): this;
|
|
630
|
+
applyFillStroke(filled?: boolean | string, stroked?: boolean | string, strokeWidth?: number): this;
|
|
631
|
+
gradient(stops: [number, string][] | string[]): ((area1: GroupLike, area2?: GroupLike) => CanvasGradient);
|
|
632
|
+
composite(mode?: GlobalCompositeOperation): this;
|
|
633
|
+
clip(): this;
|
|
634
|
+
dash(segments?: PtLike | boolean, offset?: number): this;
|
|
635
|
+
font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
636
|
+
fontWidthEstimate(estimate?: boolean): this;
|
|
637
|
+
getTextWidth(c: string): number;
|
|
638
|
+
protected _textTruncate(str: string, width: number, tail?: string): [string, number];
|
|
639
|
+
protected _textAlign(box: PtLikeIterable, vertical: string, offset?: PtLike, center?: Pt): Pt;
|
|
640
|
+
reset(): this;
|
|
641
|
+
protected _paint(): void;
|
|
642
|
+
static point(ctx: CanvasRenderingContext2D, p: PtLike, radius?: number, shape?: string): void;
|
|
643
|
+
point(p: PtLike, radius?: number, shape?: string): this;
|
|
644
|
+
static circle(ctx: CanvasRenderingContext2D, pt: PtLike, radius?: number): void;
|
|
645
|
+
circle(pts: PtLikeIterable): this;
|
|
646
|
+
static ellipse(ctx: CanvasRenderingContext2D, pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): void;
|
|
647
|
+
ellipse(pt: PtLike, radius: PtLike, rotation?: number, startAngle?: number, endAngle?: number, cc?: boolean): this;
|
|
648
|
+
static arc(ctx: CanvasRenderingContext2D, pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): void;
|
|
649
|
+
arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
650
|
+
static square(ctx: CanvasRenderingContext2D, pt: PtLike, halfsize: number): void;
|
|
651
|
+
square(pt: PtLike, halfsize: number): this;
|
|
652
|
+
static line(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
653
|
+
line(pts: PtLikeIterable): this;
|
|
654
|
+
static polygon(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
655
|
+
polygon(pts: PtLikeIterable): this;
|
|
656
|
+
static rect(ctx: CanvasRenderingContext2D, pts: PtLikeIterable): void;
|
|
657
|
+
rect(pts: PtLikeIterable): this;
|
|
658
|
+
static image(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): void;
|
|
659
|
+
image(ptOrRect: PtLike | PtLikeIterable, img: CanvasImageSource | Img, orig?: PtLikeIterable): this;
|
|
660
|
+
static imageData(ctx: CanvasRenderingContext2D, ptOrRect: PtLike | PtLikeIterable, img: ImageData): void;
|
|
661
|
+
imageData(ptOrRect: PtLike | PtLikeIterable, img: ImageData): this;
|
|
662
|
+
static text(ctx: CanvasRenderingContext2D, pt: PtLike, txt: string, maxWidth?: number): void;
|
|
663
|
+
text(pt: PtLike, txt: string, maxWidth?: number): this;
|
|
664
|
+
textBox(box: PtIterable, txt: string, verticalAlign?: string, tail?: string, overrideBaseline?: boolean): this;
|
|
665
|
+
paragraphBox(box: PtLikeIterable, txt: string, lineHeight?: number, verticalAlign?: string, crop?: boolean): this;
|
|
666
|
+
alignText(alignment?: CanvasTextAlign, baseline?: CanvasTextBaseline): this;
|
|
667
|
+
log(txt: any): this;
|
|
714
668
|
}
|
|
715
669
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
static
|
|
726
|
-
get bpm(): number;
|
|
727
|
-
set bpm(n: number);
|
|
728
|
-
get ms(): number;
|
|
729
|
-
set ms(n: number);
|
|
730
|
-
protected _createID(listener: ITempoListener | Function): string;
|
|
731
|
-
every(beats: number | number[]): ITempoResponses;
|
|
732
|
-
track(time: any): void;
|
|
733
|
-
stop(name: string): void;
|
|
734
|
-
animate(time: any, ftime: any): void;
|
|
735
|
-
resize(bound: Bound, evt?: Event): void;
|
|
736
|
-
action(type: string, px: number, py: number, evt: Event): void;
|
|
670
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
671
|
+
|
|
672
|
+
declare class Create {
|
|
673
|
+
static distributeRandom(bound: Bound, count: number, dimensions?: number): Group;
|
|
674
|
+
static distributeLinear(line: PtIterable, count: number): Group;
|
|
675
|
+
static gridPts(bound: Bound, columns: number, rows: number, orientation?: PtLike): Group;
|
|
676
|
+
static gridCells(bound: Bound, columns: number, rows: number): Group[];
|
|
677
|
+
static radialPts(center: PtLike, radius: number, count: number, angleOffset?: number): Group;
|
|
678
|
+
static noisePts(pts: PtIterable, dx?: number, dy?: number, rows?: number, columns?: number): Group;
|
|
679
|
+
static delaunay(pts: GroupLike): Delaunay;
|
|
737
680
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
protected
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
get stream(): MediaStream;
|
|
760
|
-
get source(): HTMLMediaElement;
|
|
761
|
-
get buffer(): AudioBuffer;
|
|
762
|
-
set buffer(b: AudioBuffer);
|
|
763
|
-
get type(): SoundType;
|
|
764
|
-
get playing(): boolean;
|
|
765
|
-
get progress(): number;
|
|
766
|
-
get playable(): boolean;
|
|
767
|
-
get binSize(): number;
|
|
768
|
-
get sampleRate(): number;
|
|
769
|
-
get frequency(): number;
|
|
770
|
-
set frequency(f: number);
|
|
771
|
-
connect(node: AudioNode): this;
|
|
772
|
-
setOutputNode(outputNode: AudioNode): this;
|
|
773
|
-
removeOutputNode(): this;
|
|
774
|
-
analyze(size?: number, minDb?: number, maxDb?: number, smooth?: number): this;
|
|
775
|
-
protected _domain(time: boolean): Uint8Array;
|
|
776
|
-
protected _domainTo(time: boolean, size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
777
|
-
timeDomain(): Uint8Array;
|
|
778
|
-
timeDomainTo(size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
779
|
-
freqDomain(): Uint8Array;
|
|
780
|
-
freqDomainTo(size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
781
|
-
reset(): this;
|
|
782
|
-
start(timeAt?: number): this;
|
|
783
|
-
stop(): this;
|
|
784
|
-
toggle(): this;
|
|
681
|
+
declare class Noise extends Pt {
|
|
682
|
+
protected perm: number[];
|
|
683
|
+
private _n;
|
|
684
|
+
constructor(...args: any[]);
|
|
685
|
+
initNoise(...args: any[]): this;
|
|
686
|
+
step(x?: number, y?: number): this;
|
|
687
|
+
seed(s: any): this;
|
|
688
|
+
noise2D(): number;
|
|
689
|
+
}
|
|
690
|
+
declare class Delaunay extends Group {
|
|
691
|
+
private _mesh;
|
|
692
|
+
delaunay(triangleOnly?: boolean): GroupLike[] | DelaunayShape[];
|
|
693
|
+
voronoi(): Group[];
|
|
694
|
+
mesh(): DelaunayMesh;
|
|
695
|
+
neighborPts(i: number, sort?: boolean): GroupLike;
|
|
696
|
+
neighbors(i: number): DelaunayShape[];
|
|
697
|
+
protected _cache(o: any): void;
|
|
698
|
+
protected _superTriangle(): Group;
|
|
699
|
+
protected _triangle(i: number, j: number, k: number, pts?: GroupLike): Group;
|
|
700
|
+
protected _circum(i: number, j: number, k: number, tri: GroupLike | false, pts?: GroupLike): DelaunayShape;
|
|
701
|
+
protected static _dedupe(edges: number[]): number[];
|
|
785
702
|
}
|
|
786
703
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
static
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
projectScalar(...args: any[]): number;
|
|
827
|
-
abs(): Pt;
|
|
828
|
-
$abs(): Pt;
|
|
829
|
-
floor(): Pt;
|
|
830
|
-
$floor(): Pt;
|
|
831
|
-
ceil(): Pt;
|
|
832
|
-
$ceil(): Pt;
|
|
833
|
-
round(): Pt;
|
|
834
|
-
$round(): Pt;
|
|
835
|
-
minValue(): {
|
|
836
|
-
value: number;
|
|
837
|
-
index: number;
|
|
704
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
705
|
+
|
|
706
|
+
declare class Num {
|
|
707
|
+
static generator: any;
|
|
708
|
+
static equals(a: number, b: number, threshold?: number): boolean;
|
|
709
|
+
static lerp(a: number, b: number, t: number): number;
|
|
710
|
+
static clamp(val: number, min: number, max: number): number;
|
|
711
|
+
static boundValue(val: number, min: number, max: number): number;
|
|
712
|
+
static within(p: number, a: number, b: number): boolean;
|
|
713
|
+
static randomRange(a: number, b?: number): number;
|
|
714
|
+
static randomPt(a: PtLike, b?: PtLike): Pt;
|
|
715
|
+
static normalizeValue(n: number, a: number, b: number): number;
|
|
716
|
+
static sum(pts: PtLikeIterable): Pt;
|
|
717
|
+
static average(pts: PtLikeIterable): Pt;
|
|
718
|
+
static cycle(t: number, method?: (t: number) => number): number;
|
|
719
|
+
static mapToRange(n: number, currA: number, currB: number, targetA: number, targetB: number): number;
|
|
720
|
+
static seed(seed: string): void;
|
|
721
|
+
static random(): number;
|
|
722
|
+
}
|
|
723
|
+
declare class Geom {
|
|
724
|
+
static boundAngle(angle: number): number;
|
|
725
|
+
static boundRadian(radian: number): number;
|
|
726
|
+
static toRadian(angle: number): number;
|
|
727
|
+
static toDegree(radian: number): number;
|
|
728
|
+
static boundingBox(pts: PtIterable): Group;
|
|
729
|
+
static centroid(pts: PtLikeIterable): Pt;
|
|
730
|
+
static anchor(pts: PtLikeIterable, ptOrIndex?: PtLike | number, direction?: ("to" | "from")): void;
|
|
731
|
+
static interpolate(a: PtLike, b: PtLike, t?: number): Pt;
|
|
732
|
+
static perpendicular(pt: PtLike, axis?: string | PtLike): Group;
|
|
733
|
+
static isPerpendicular(p1: PtLike, p2: PtLike): boolean;
|
|
734
|
+
static withinBound(pt: PtLike, boundPt1: PtLike, boundPt2: PtLike): boolean;
|
|
735
|
+
static sortEdges(pts: PtIterable): GroupLike;
|
|
736
|
+
static scale(ps: Pt | PtIterable, scale: number | PtLike, anchor?: PtLike): Geom;
|
|
737
|
+
static rotate2D(ps: Pt | PtIterable, angle: number, anchor?: PtLike, axis?: string | PtLike): Geom;
|
|
738
|
+
static shear2D(ps: Pt | PtIterable, scale: number | PtLike, anchor?: PtLike, axis?: string | PtLike): Geom;
|
|
739
|
+
static reflect2D(ps: Pt | PtIterable, line: PtLikeIterable, axis?: string | PtLike): Geom;
|
|
740
|
+
static cosTable(): {
|
|
741
|
+
table: Float64Array;
|
|
742
|
+
cos: (rad: number) => number;
|
|
838
743
|
};
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
744
|
+
static sinTable(): {
|
|
745
|
+
table: Float64Array;
|
|
746
|
+
sin: (rad: number) => number;
|
|
842
747
|
};
|
|
843
|
-
$min(...args: any[]): Pt;
|
|
844
|
-
$max(...args: any[]): Pt;
|
|
845
|
-
angle(axis?: string | number[]): number;
|
|
846
|
-
angleBetween(p: Pt, axis?: string | number[]): number;
|
|
847
|
-
scale(scale: number | number[] | PtLike, anchor?: PtLike): this;
|
|
848
|
-
rotate2D(angle: number, anchor?: PtLike, axis?: string): this;
|
|
849
|
-
shear2D(scale: number | number[] | PtLike, anchor?: PtLike, axis?: string): this;
|
|
850
|
-
reflect2D(line: GroupLike, axis?: string): this;
|
|
851
|
-
toString(): string;
|
|
852
|
-
toArray(): number[];
|
|
853
|
-
toGroup(): Group;
|
|
854
|
-
toBound(): Bound;
|
|
855
748
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
static
|
|
871
|
-
static
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
rotate2D(angle: number, anchor?: PtLike, axis?: string): this;
|
|
888
|
-
shear2D(scale: number | number[] | PtLike, anchor?: PtLike, axis?: string): this;
|
|
889
|
-
reflect2D(line: PtLikeIterable, axis?: string): this;
|
|
890
|
-
sortByDimension(dim: number, desc?: boolean): this;
|
|
891
|
-
forEachPt(ptFn: string, ...args: any[]): this;
|
|
892
|
-
add(...args: any[]): this;
|
|
893
|
-
subtract(...args: any[]): this;
|
|
894
|
-
multiply(...args: any[]): this;
|
|
895
|
-
divide(...args: any[]): this;
|
|
896
|
-
$matrixAdd(g: GroupLike | number[][] | number): Group;
|
|
897
|
-
$matrixMultiply(g: GroupLike | number, transposed?: boolean, elementwise?: boolean): Group;
|
|
898
|
-
zipSlice(index: number, defaultValue?: number | boolean): Pt;
|
|
899
|
-
$zip(defaultValue?: number | boolean, useLongest?: boolean): Group;
|
|
900
|
-
toBound(): Group;
|
|
901
|
-
toString(): string;
|
|
749
|
+
declare class Shaping {
|
|
750
|
+
static linear(t: number, c?: number): number;
|
|
751
|
+
static quadraticIn(t: number, c?: number): number;
|
|
752
|
+
static quadraticOut(t: number, c?: number): number;
|
|
753
|
+
static quadraticInOut(t: number, c?: number): number;
|
|
754
|
+
static cubicIn(t: number, c?: number): number;
|
|
755
|
+
static cubicOut(t: number, c?: number): number;
|
|
756
|
+
static cubicInOut(t: number, c?: number): number;
|
|
757
|
+
static exponentialIn(t: number, c?: number, p?: number): number;
|
|
758
|
+
static exponentialOut(t: number, c?: number, p?: number): number;
|
|
759
|
+
static sineIn(t: number, c?: number): number;
|
|
760
|
+
static sineOut(t: number, c?: number): number;
|
|
761
|
+
static sineInOut(t: number, c?: number): number;
|
|
762
|
+
static cosineApprox(t: number, c?: number): number;
|
|
763
|
+
static circularIn(t: number, c?: number): number;
|
|
764
|
+
static circularOut(t: number, c?: number): number;
|
|
765
|
+
static circularInOut(t: number, c?: number): number;
|
|
766
|
+
static elasticIn(t: number, c?: number, p?: number): number;
|
|
767
|
+
static elasticOut(t: number, c?: number, p?: number): number;
|
|
768
|
+
static elasticInOut(t: number, c?: number, p?: number): number;
|
|
769
|
+
static bounceIn(t: number, c?: number): number;
|
|
770
|
+
static bounceOut(t: number, c?: number): number;
|
|
771
|
+
static bounceInOut(t: number, c?: number): number;
|
|
772
|
+
static sigmoid(t: number, c?: number, p?: number): number;
|
|
773
|
+
static logSigmoid(t: number, c?: number, p?: number): number;
|
|
774
|
+
static seat(t: number, c?: number, p?: number): number;
|
|
775
|
+
static quadraticBezier(t: number, c?: number, p?: number | PtLike): number;
|
|
776
|
+
static cubicBezier(t: number, c?: number, p1?: PtLike, p2?: PtLike): number;
|
|
777
|
+
static quadraticTarget(t: number, c?: number, p1?: PtLike): number;
|
|
778
|
+
static cliff(t: number, c?: number, p?: number): number;
|
|
779
|
+
static step(fn: Function, steps: number, t: number, c: number, ...args: any[]): any;
|
|
902
780
|
}
|
|
903
|
-
|
|
904
|
-
protected
|
|
905
|
-
protected
|
|
906
|
-
protected
|
|
907
|
-
protected
|
|
908
|
-
protected
|
|
909
|
-
constructor(
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
781
|
+
declare class Range {
|
|
782
|
+
protected _source: Group;
|
|
783
|
+
protected _max: Pt;
|
|
784
|
+
protected _min: Pt;
|
|
785
|
+
protected _mag: Pt;
|
|
786
|
+
protected _dims: number;
|
|
787
|
+
constructor(g: PtIterable);
|
|
788
|
+
get max(): Pt;
|
|
789
|
+
get min(): Pt;
|
|
790
|
+
get magnitude(): Pt;
|
|
791
|
+
calc(): this;
|
|
792
|
+
mapTo(min: number, max: number, exclude?: boolean[]): Group;
|
|
793
|
+
append(pts: PtLikeIterable, update?: boolean): this;
|
|
794
|
+
ticks(count: number): Group;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
798
|
+
|
|
799
|
+
declare class Line {
|
|
800
|
+
static fromAngle(anchor: PtLike, angle: number, magnitude: number): Group;
|
|
801
|
+
static slope(p1: PtLike, p2: PtLike): number;
|
|
802
|
+
static intercept(p1: PtLike, p2: PtLike): {
|
|
803
|
+
slope: number;
|
|
804
|
+
xi: number;
|
|
805
|
+
yi: number;
|
|
806
|
+
};
|
|
807
|
+
static sideOfPt2D(line: PtLikeIterable, pt: PtLike): number;
|
|
808
|
+
static collinear(p1: PtLike, p2: PtLike, p3: PtLike, threshold?: number): boolean;
|
|
809
|
+
static magnitude(line: PtIterable): number;
|
|
810
|
+
static magnitudeSq(line: PtIterable): number;
|
|
811
|
+
static perpendicularFromPt(line: PtIterable, pt: PtLike, asProjection?: boolean): Pt;
|
|
812
|
+
static distanceFromPt(line: GroupLike, pt: PtLike | number[]): number;
|
|
813
|
+
static intersectRay2D(la: PtIterable, lb: PtIterable): Pt;
|
|
814
|
+
static intersectLine2D(la: PtIterable, lb: PtIterable): Pt;
|
|
815
|
+
static intersectLineWithRay2D(line: PtIterable, ray: PtIterable): Pt;
|
|
816
|
+
static intersectPolygon2D(lineOrRay: PtIterable, poly: PtIterable, sourceIsRay?: boolean): Group;
|
|
817
|
+
static intersectLines2D(lines1: Iterable<PtIterable>, lines2: Iterable<PtIterable>, isRay?: boolean): Group;
|
|
818
|
+
static intersectGridWithRay2D(ray: PtIterable, gridPt: PtLike): Group;
|
|
819
|
+
static intersectGridWithLine2D(line: GroupLike, gridPt: PtLike | number[]): Group;
|
|
820
|
+
static intersectRect2D(line: GroupLike, rect: GroupLike): Group;
|
|
821
|
+
static subpoints(line: PtLikeIterable, num: number): Group;
|
|
822
|
+
static crop(line: PtIterable, size: PtLike, index?: number, cropAsCircle?: boolean): Pt;
|
|
823
|
+
static marker(line: PtIterable, size: PtLike, graphic?: string, atTail?: boolean): Group;
|
|
824
|
+
static toRect(line: GroupLike): Group;
|
|
825
|
+
}
|
|
826
|
+
declare class Rectangle {
|
|
827
|
+
static from(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
|
|
828
|
+
static fromTopLeft(topLeft: PtLike, widthOrSize: number | PtLike, height?: number): Group;
|
|
829
|
+
static fromCenter(center: PtLike, widthOrSize: number | PtLike, height?: number): Group;
|
|
830
|
+
static toCircle(pts: PtIterable, within?: boolean): Group;
|
|
831
|
+
static toSquare(pts: PtIterable, enclose?: boolean): Group;
|
|
832
|
+
static size(pts: PtIterable): Pt;
|
|
833
|
+
static center(pts: PtIterable): Pt;
|
|
834
|
+
static corners(rect: PtIterable): Group;
|
|
835
|
+
static sides(rect: PtIterable): Group[];
|
|
836
|
+
static boundingBox(rects: Iterable<PtLikeIterable>): Group;
|
|
837
|
+
static polygon(rect: PtIterable): Group;
|
|
838
|
+
static quadrants(rect: PtIterable, center?: PtLike): Group[];
|
|
839
|
+
static halves(rect: PtIterable, ratio?: number, asRows?: boolean): Group[];
|
|
840
|
+
static withinBound(rect: GroupLike, pt: PtLike): boolean;
|
|
841
|
+
static hasIntersectRect2D(rect1: GroupLike, rect2: GroupLike, resetBoundingBox?: boolean): boolean;
|
|
842
|
+
static intersectRect2D(rect1: GroupLike, rect2: GroupLike): Group;
|
|
843
|
+
}
|
|
844
|
+
declare class Circle {
|
|
845
|
+
static fromRect(pts: PtLikeIterable, enclose?: boolean): Group;
|
|
846
|
+
static fromTriangle(pts: PtIterable, enclose?: boolean): Group;
|
|
847
|
+
static fromCenter(pt: PtLike, radius: number): Group;
|
|
848
|
+
static withinBound(pts: PtIterable, pt: PtLike, threshold?: number): boolean;
|
|
849
|
+
static intersectRay2D(circle: PtIterable, ray: PtIterable): Group;
|
|
850
|
+
static intersectLine2D(circle: PtIterable, line: PtIterable): Group;
|
|
851
|
+
static intersectCircle2D(circle1: PtIterable, circle2: PtIterable): Group;
|
|
852
|
+
static intersectRect2D(circle: PtIterable, rect: PtIterable): Group;
|
|
853
|
+
static toRect(circle: PtIterable, within?: boolean): Group;
|
|
854
|
+
static toTriangle(circle: PtIterable, within?: boolean): Group;
|
|
855
|
+
}
|
|
856
|
+
declare class Triangle {
|
|
857
|
+
static fromRect(rect: PtIterable): Group;
|
|
858
|
+
static fromCircle(circle: PtIterable): Group;
|
|
859
|
+
static fromCenter(pt: PtLike, size: number): Group;
|
|
860
|
+
static medial(tri: PtIterable): Group;
|
|
861
|
+
static oppositeSide(tri: PtIterable, index: number): Group;
|
|
862
|
+
static altitude(tri: PtIterable, index: number): Group;
|
|
863
|
+
static orthocenter(tri: PtIterable): Pt;
|
|
864
|
+
static incenter(tri: PtIterable): Pt;
|
|
865
|
+
static incircle(tri: PtIterable, center?: Pt): Group;
|
|
866
|
+
static circumcenter(tri: PtIterable): Pt;
|
|
867
|
+
static circumcircle(tri: PtIterable, center?: Pt): Group;
|
|
868
|
+
}
|
|
869
|
+
declare class Polygon {
|
|
870
|
+
static centroid(pts: PtLikeIterable): Pt;
|
|
871
|
+
static rectangle(center: PtLike, widthOrSize: number | PtLike, height?: number): Group;
|
|
872
|
+
static fromCenter(center: PtLike, radius: number, sides: number): Group;
|
|
873
|
+
static lineAt(pts: PtLikeIterable, index: number): Group;
|
|
874
|
+
static lines(poly: PtIterable, closePath?: boolean): Group[];
|
|
875
|
+
static midpoints(poly: PtIterable, closePath?: boolean, t?: number): Group;
|
|
876
|
+
static adjacentSides(poly: PtIterable, index: number, closePath?: boolean): Group[];
|
|
877
|
+
static bisector(poly: PtIterable, index: number): Pt;
|
|
878
|
+
static perimeter(poly: PtIterable, closePath?: boolean): {
|
|
879
|
+
total: number;
|
|
880
|
+
segments: Pt;
|
|
881
|
+
};
|
|
882
|
+
static area(pts: PtLikeIterable): any;
|
|
883
|
+
static convexHull(pts: PtLikeIterable, sorted?: boolean): Group;
|
|
884
|
+
static network(poly: PtIterable, originIndex?: number): Group[];
|
|
885
|
+
static nearestPt(poly: PtIterable, pt: PtLike): number;
|
|
886
|
+
static projectAxis(poly: PtIterable, unitAxis: Pt): Pt;
|
|
887
|
+
protected static _axisOverlap(poly1: PtIterable, poly2: PtIterable, unitAxis: Pt): number;
|
|
888
|
+
static hasIntersectPoint(poly: PtLikeIterable, pt: PtLike): boolean;
|
|
889
|
+
static hasIntersectCircle(poly: PtIterable, circle: PtIterable): IntersectContext;
|
|
890
|
+
static hasIntersectPolygon(poly1: PtIterable, poly2: PtIterable): IntersectContext;
|
|
891
|
+
static intersectPolygon2D(poly1: PtIterable, poly2: PtIterable): Group;
|
|
892
|
+
static toRects(polys: Iterable<PtIterable>): Group[];
|
|
893
|
+
}
|
|
894
|
+
declare class Curve {
|
|
895
|
+
static getSteps(steps: number): Group;
|
|
896
|
+
static controlPoints(pts: PtLikeIterable, index?: number, copyStart?: boolean): Group;
|
|
897
|
+
static _calcPt(ctrls: GroupLike, params: PtLike): Pt;
|
|
898
|
+
static catmullRom(pts: PtLikeIterable, steps?: number): Group;
|
|
899
|
+
static catmullRomStep(step: Pt, ctrls: GroupLike): Pt;
|
|
900
|
+
static cardinal(pts: PtLikeIterable, steps?: number, tension?: number): Group;
|
|
901
|
+
static cardinalStep(step: Pt, ctrls: GroupLike, tension?: number): Pt;
|
|
902
|
+
static bezier(pts: GroupLike, steps?: number): Group;
|
|
903
|
+
static bezierStep(step: Pt, ctrls: GroupLike): Pt;
|
|
904
|
+
static bspline(pts: GroupLike, steps?: number, tension?: number): Group;
|
|
905
|
+
static bsplineStep(step: Pt, ctrls: GroupLike): Pt;
|
|
906
|
+
static bsplineTensionStep(step: Pt, ctrls: GroupLike, tension?: number): Pt;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
910
|
+
|
|
911
|
+
declare class Color extends Pt {
|
|
912
|
+
private static D65;
|
|
913
|
+
protected _mode: ColorType;
|
|
914
|
+
private _isNorm;
|
|
915
|
+
static ranges: {
|
|
916
|
+
[name: string]: Group;
|
|
917
|
+
};
|
|
918
|
+
constructor(...args: any[]);
|
|
919
|
+
static from(...args: any[]): Color;
|
|
920
|
+
static fromHex(hex: string): Color;
|
|
921
|
+
static rgb(...args: any[]): Color;
|
|
922
|
+
static hsl(...args: any[]): Color;
|
|
923
|
+
static hsb(...args: any[]): Color;
|
|
924
|
+
static lab(...args: any[]): Color;
|
|
925
|
+
static lch(...args: any[]): Color;
|
|
926
|
+
static luv(...args: any[]): Color;
|
|
927
|
+
static xyz(...args: any[]): Color;
|
|
928
|
+
static maxValues(mode: string): Pt;
|
|
929
|
+
get hex(): string;
|
|
930
|
+
get rgb(): string;
|
|
931
|
+
get rgba(): string;
|
|
932
|
+
clone(): Color;
|
|
933
|
+
toMode(mode: ColorType, convert?: boolean): this;
|
|
934
|
+
get mode(): ColorType;
|
|
935
|
+
get r(): number;
|
|
936
|
+
set r(n: number);
|
|
937
|
+
get g(): number;
|
|
938
|
+
set g(n: number);
|
|
939
|
+
get b(): number;
|
|
940
|
+
set b(n: number);
|
|
941
|
+
get h(): number;
|
|
942
|
+
set h(n: number);
|
|
943
|
+
get s(): number;
|
|
944
|
+
set s(n: number);
|
|
945
|
+
get l(): number;
|
|
946
|
+
set l(n: number);
|
|
947
|
+
get a(): number;
|
|
948
|
+
set a(n: number);
|
|
949
|
+
get c(): number;
|
|
950
|
+
set c(n: number);
|
|
951
|
+
get u(): number;
|
|
952
|
+
set u(n: number);
|
|
953
|
+
get v(): number;
|
|
954
|
+
set v(n: number);
|
|
955
|
+
set alpha(n: number);
|
|
956
|
+
get alpha(): number;
|
|
957
|
+
get normalized(): boolean;
|
|
958
|
+
set normalized(b: boolean);
|
|
959
|
+
normalize(toNorm?: boolean): Color;
|
|
960
|
+
$normalize(toNorm?: boolean): Color;
|
|
961
|
+
toString(format?: ("hex" | "rgb" | "rgba" | "mode")): string;
|
|
962
|
+
static RGBtoHSL(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
963
|
+
static HSLtoRGB(hsl: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
964
|
+
static RGBtoHSB(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
965
|
+
static HSBtoRGB(hsb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
966
|
+
static RGBtoLAB(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
967
|
+
static LABtoRGB(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
968
|
+
static RGBtoLCH(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
969
|
+
static LCHtoRGB(lch: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
970
|
+
static RGBtoLUV(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
971
|
+
static LUVtoRGB(luv: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
972
|
+
static RGBtoXYZ(rgb: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
973
|
+
static XYZtoRGB(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
974
|
+
static XYZtoLAB(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
975
|
+
static LABtoXYZ(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
976
|
+
static XYZtoLUV(xyz: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
977
|
+
static LUVtoXYZ(luv: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
978
|
+
static LABtoLCH(lab: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
979
|
+
static LCHtoLAB(lch: Color, normalizedInput?: boolean, normalizedOutput?: boolean): Color;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
983
|
+
|
|
984
|
+
declare const Const: {
|
|
985
|
+
xy: string;
|
|
986
|
+
yz: string;
|
|
987
|
+
xz: string;
|
|
988
|
+
xyz: string;
|
|
989
|
+
horizontal: number;
|
|
990
|
+
vertical: number;
|
|
991
|
+
identical: number;
|
|
992
|
+
right: number;
|
|
993
|
+
bottom_right: number;
|
|
994
|
+
bottom: number;
|
|
995
|
+
bottom_left: number;
|
|
996
|
+
left: number;
|
|
997
|
+
top_left: number;
|
|
998
|
+
top: number;
|
|
999
|
+
top_right: number;
|
|
1000
|
+
epsilon: number;
|
|
1001
|
+
max: number;
|
|
1002
|
+
min: number;
|
|
1003
|
+
pi: number;
|
|
1004
|
+
two_pi: number;
|
|
1005
|
+
half_pi: number;
|
|
1006
|
+
quarter_pi: number;
|
|
1007
|
+
one_degree: number;
|
|
1008
|
+
rad_to_deg: number;
|
|
1009
|
+
deg_to_rad: number;
|
|
1010
|
+
gravity: number;
|
|
1011
|
+
newton: number;
|
|
1012
|
+
gaussian: number;
|
|
1013
|
+
};
|
|
1014
|
+
declare class Util {
|
|
1015
|
+
static _warnLevel: WarningType;
|
|
1016
|
+
static warnLevel(lv?: WarningType): WarningType;
|
|
1017
|
+
static getArgs(args: any[]): Array<number>;
|
|
1018
|
+
static warn(message?: string, defaultReturn?: any): any;
|
|
1019
|
+
static randomInt(range: number, start?: number): number;
|
|
1020
|
+
static split(pts: any[], size: number, stride?: number, loopBack?: boolean, matchSize?: boolean): any[][];
|
|
1021
|
+
static flatten(pts: any[], flattenAsGroup?: boolean): any;
|
|
1022
|
+
static combine<T>(a: T[], b: T[], op: (a: T, b: T) => T): T[];
|
|
1023
|
+
static zip(arrays: Array<any>[]): any[];
|
|
1024
|
+
static stepper(max: number, min?: number, stride?: number, callback?: (n: number) => void): (() => number);
|
|
1025
|
+
static forRange(fn: (index: number) => any, range: number, start?: number, step?: number): any[];
|
|
1026
|
+
static load(url: string, callback: (response: string, success: boolean) => void): void;
|
|
1027
|
+
static download(space: CanvasSpace, filename?: string, filetype?: ("jpeg" | "jpg" | "png" | "webp"), quality?: number): void;
|
|
1028
|
+
static performance(avgFrames?: number): () => number;
|
|
1029
|
+
static arrayCheck(pts: PtLikeIterable, minRequired?: number): boolean;
|
|
1030
|
+
static iterToArray(it: Iterable<any>): any[];
|
|
1031
|
+
static isMobile(): boolean;
|
|
938
1032
|
}
|
|
939
1033
|
|
|
940
|
-
|
|
1034
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1035
|
+
|
|
1036
|
+
declare class DOMSpace extends MultiTouchSpace {
|
|
1037
|
+
protected _canvas: HTMLElement | SVGElement;
|
|
1038
|
+
protected _container: Element;
|
|
941
1039
|
id: string;
|
|
942
|
-
protected
|
|
943
|
-
protected
|
|
944
|
-
protected
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1040
|
+
protected _autoResize: boolean;
|
|
1041
|
+
protected _bgcolor: string;
|
|
1042
|
+
protected _css: {};
|
|
1043
|
+
constructor(elem: string | Element, callback?: Function);
|
|
1044
|
+
static createElement(elem: string, id: string, appendTo?: Element): Element;
|
|
1045
|
+
private _ready;
|
|
1046
|
+
setup(opt: {
|
|
1047
|
+
bgcolor?: string;
|
|
1048
|
+
resize?: boolean;
|
|
1049
|
+
}): this;
|
|
1050
|
+
getForm(): Form;
|
|
1051
|
+
set autoResize(auto: boolean);
|
|
1052
|
+
get autoResize(): boolean;
|
|
1053
|
+
resize(b: Bound, evt?: Event): this;
|
|
1054
|
+
protected _resizeHandler(evt: Event): void;
|
|
1055
|
+
get element(): Element;
|
|
1056
|
+
get parent(): Element;
|
|
1057
|
+
get ready(): boolean;
|
|
1058
|
+
clear(bg?: string): this;
|
|
1059
|
+
set background(bg: string);
|
|
1060
|
+
get background(): string;
|
|
1061
|
+
style(key: string, val: string, update?: boolean): this;
|
|
1062
|
+
styles(styles: object, update?: boolean): this;
|
|
1063
|
+
static setAttr(elem: Element, data: object): Element;
|
|
1064
|
+
static getInlineStyles(data: object): string;
|
|
1065
|
+
dispose(): this;
|
|
1066
|
+
}
|
|
1067
|
+
declare class HTMLSpace extends DOMSpace {
|
|
1068
|
+
getForm(): Form;
|
|
1069
|
+
static htmlElement(parent: Element, name: string, id?: string, autoClass?: boolean): HTMLElement;
|
|
955
1070
|
remove(player: IPlayer): this;
|
|
956
1071
|
removeAll(): this;
|
|
957
|
-
play(time?: number): this;
|
|
958
|
-
replay(): void;
|
|
959
|
-
protected playItems(time: number): void;
|
|
960
|
-
pause(toggle?: boolean): this;
|
|
961
|
-
resume(): this;
|
|
962
|
-
stop(t?: number): this;
|
|
963
|
-
playOnce(duration?: number): this;
|
|
964
|
-
protected render(context: any): this;
|
|
965
|
-
set customRendering(f: (context: any, self: Space) => null);
|
|
966
|
-
get customRendering(): (context: any, self: Space) => null;
|
|
967
|
-
get isPlaying(): boolean;
|
|
968
|
-
get outerBound(): Bound;
|
|
969
|
-
get innerBound(): Bound;
|
|
970
|
-
get size(): Pt;
|
|
971
|
-
get center(): Pt;
|
|
972
|
-
get width(): number;
|
|
973
|
-
get height(): number;
|
|
974
|
-
abstract resize(b: Bound, evt?: Event): this;
|
|
975
|
-
abstract clear(): this;
|
|
976
|
-
abstract getForm(): Form;
|
|
977
1072
|
}
|
|
978
|
-
|
|
979
|
-
protected
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
protected
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
protected
|
|
999
|
-
protected
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
protected
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1073
|
+
declare class HTMLForm extends VisualForm {
|
|
1074
|
+
protected _style: {
|
|
1075
|
+
filled: boolean;
|
|
1076
|
+
stroked: boolean;
|
|
1077
|
+
background: string;
|
|
1078
|
+
"border-color": string;
|
|
1079
|
+
color: string;
|
|
1080
|
+
"border-width": string;
|
|
1081
|
+
"border-radius": string;
|
|
1082
|
+
"border-style": string;
|
|
1083
|
+
opacity: number;
|
|
1084
|
+
position: string;
|
|
1085
|
+
top: number;
|
|
1086
|
+
left: number;
|
|
1087
|
+
width: number;
|
|
1088
|
+
height: number;
|
|
1089
|
+
};
|
|
1090
|
+
protected _ctx: DOMFormContext;
|
|
1091
|
+
static groupID: number;
|
|
1092
|
+
static domID: number;
|
|
1093
|
+
protected _space: HTMLSpace;
|
|
1094
|
+
protected _ready: boolean;
|
|
1095
|
+
constructor(space: HTMLSpace);
|
|
1096
|
+
get space(): HTMLSpace;
|
|
1097
|
+
protected styleTo(k: any, v: any, unit?: string): void;
|
|
1098
|
+
alpha(a: number): this;
|
|
1099
|
+
fill(c: string | boolean): this;
|
|
1100
|
+
stroke(c: string | boolean, width?: number, linejoin?: string, linecap?: string): this;
|
|
1101
|
+
fillText(c: string): this;
|
|
1102
|
+
cls(c: string | boolean): this;
|
|
1103
|
+
font(sizeOrFont: number | Font, weight?: string, style?: string, lineHeight?: number, family?: string): this;
|
|
1104
|
+
reset(): this;
|
|
1105
|
+
updateScope(group_id: string, group?: Element): object;
|
|
1106
|
+
scope(item: IPlayer): object;
|
|
1107
|
+
nextID(): string;
|
|
1108
|
+
static getID(ctx: any): string;
|
|
1109
|
+
static scopeID(item: IPlayer): string;
|
|
1110
|
+
static style(elem: Element, styles: object): Element;
|
|
1111
|
+
static rectStyle(ctx: DOMFormContext, pt: PtLike, size: PtLike): DOMFormContext;
|
|
1112
|
+
static textStyle(ctx: DOMFormContext, pt: PtLike): DOMFormContext;
|
|
1113
|
+
static point(ctx: DOMFormContext, pt: PtLike, radius?: number, shape?: string): Element;
|
|
1114
|
+
point(pt: PtLike, radius?: number, shape?: string): this;
|
|
1115
|
+
static circle(ctx: DOMFormContext, pt: PtLike, radius?: number): Element;
|
|
1116
|
+
circle(pts: GroupLike | number[][]): this;
|
|
1117
|
+
static square(ctx: DOMFormContext, pt: PtLike, halfsize: number): HTMLElement;
|
|
1118
|
+
square(pt: PtLike, halfsize: number): this;
|
|
1119
|
+
static rect(ctx: DOMFormContext, pts: PtLikeIterable): Element;
|
|
1120
|
+
rect(pts: PtLikeIterable): this;
|
|
1121
|
+
static text(ctx: DOMFormContext, pt: PtLike, txt: string): Element;
|
|
1122
|
+
text(pt: PtLike, txt: string): this;
|
|
1123
|
+
log(txt: any): this;
|
|
1124
|
+
arc(pt: PtLike, radius: number, startAngle: number, endAngle: number, cc?: boolean): this;
|
|
1125
|
+
line(pts: GroupLike | number[][]): this;
|
|
1126
|
+
polygon(pts: GroupLike | number[][]): this;
|
|
1007
1127
|
}
|
|
1008
1128
|
|
|
1009
|
-
|
|
1129
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1130
|
+
|
|
1131
|
+
declare class SVGSpace extends DOMSpace {
|
|
1010
1132
|
protected _bgcolor: string;
|
|
1011
1133
|
constructor(elem: string | Element, callback?: Function);
|
|
1012
1134
|
getForm(): SVGForm;
|
|
@@ -1016,7 +1138,7 @@ export class SVGSpace extends DOMSpace {
|
|
|
1016
1138
|
remove(player: IPlayer): this;
|
|
1017
1139
|
removeAll(): this;
|
|
1018
1140
|
}
|
|
1019
|
-
|
|
1141
|
+
declare class SVGForm extends VisualForm {
|
|
1020
1142
|
protected _style: {
|
|
1021
1143
|
filled: boolean;
|
|
1022
1144
|
stroked: boolean;
|
|
@@ -1071,258 +1193,178 @@ export class SVGForm extends VisualForm {
|
|
|
1071
1193
|
log(txt: any): this;
|
|
1072
1194
|
}
|
|
1073
1195
|
|
|
1074
|
-
|
|
1075
|
-
x?: number;
|
|
1076
|
-
y?: number;
|
|
1077
|
-
z?: number;
|
|
1078
|
-
w?: number;
|
|
1079
|
-
}
|
|
1080
|
-
export type PtLike = Pt | Float32Array | number[];
|
|
1081
|
-
export type GroupLike = Group | Pt[];
|
|
1082
|
-
export type PtLikeIterable = GroupLike | PtLike[] | Iterable<PtLike>;
|
|
1083
|
-
export type PtIterable = GroupLike | Pt[] | Iterable<Pt>;
|
|
1084
|
-
export type AnimateCallbackFn = (time?: number, frameTime?: number, currentSpace?: any) => void;
|
|
1085
|
-
export interface IPlayer {
|
|
1086
|
-
animateID?: string;
|
|
1087
|
-
animate?: AnimateCallbackFn;
|
|
1088
|
-
resize?(bound: Bound, evt?: Event): void;
|
|
1089
|
-
action?(type: string, px: number, py: number, evt: Event): void;
|
|
1090
|
-
start?(bound: Bound, space: Space): void;
|
|
1091
|
-
}
|
|
1092
|
-
export interface ISpacePlayers {
|
|
1093
|
-
[key: string]: IPlayer;
|
|
1094
|
-
}
|
|
1095
|
-
export interface ITimer {
|
|
1096
|
-
prev: number;
|
|
1097
|
-
diff: number;
|
|
1098
|
-
end: number;
|
|
1099
|
-
min: number;
|
|
1100
|
-
}
|
|
1101
|
-
export type TouchPointsKey = "touches" | "changedTouches" | "targetTouches";
|
|
1102
|
-
export interface MultiTouchElement {
|
|
1103
|
-
addEventListener(evt: any, callback: Function): any;
|
|
1104
|
-
removeEventListener(evt: any, callback: Function): any;
|
|
1105
|
-
}
|
|
1106
|
-
export interface PtsCanvasRenderingContext2D extends CanvasRenderingContext2D {
|
|
1107
|
-
webkitBackingStorePixelRatio?: number;
|
|
1108
|
-
mozBackingStorePixelRatio?: number;
|
|
1109
|
-
msBackingStorePixelRatio?: number;
|
|
1110
|
-
oBackingStorePixelRatio?: number;
|
|
1111
|
-
backingStorePixelRatio?: number;
|
|
1112
|
-
}
|
|
1113
|
-
export type CanvasSpaceOptions = {
|
|
1114
|
-
bgcolor?: string;
|
|
1115
|
-
resize?: boolean;
|
|
1116
|
-
retina?: boolean;
|
|
1117
|
-
offscreen?: boolean;
|
|
1118
|
-
pixelDensity?: number;
|
|
1119
|
-
};
|
|
1120
|
-
export type ColorType = "rgb" | "hsl" | "hsb" | "lab" | "lch" | "luv" | "xyz";
|
|
1121
|
-
export type DelaunayShape = {
|
|
1122
|
-
i: number;
|
|
1123
|
-
j: number;
|
|
1124
|
-
k: number;
|
|
1125
|
-
triangle: GroupLike;
|
|
1126
|
-
circle: Group;
|
|
1127
|
-
};
|
|
1128
|
-
export type DelaunayMesh = {
|
|
1129
|
-
[key: string]: DelaunayShape;
|
|
1130
|
-
}[];
|
|
1131
|
-
export type DOMFormContext = {
|
|
1132
|
-
group: Element;
|
|
1133
|
-
groupID: string;
|
|
1134
|
-
groupCount: number;
|
|
1135
|
-
currentID: string;
|
|
1136
|
-
currentClass?: string;
|
|
1137
|
-
style: object;
|
|
1138
|
-
};
|
|
1139
|
-
export type IntersectContext = {
|
|
1140
|
-
which: number;
|
|
1141
|
-
dist: number;
|
|
1142
|
-
normal: Pt;
|
|
1143
|
-
vertex: Pt;
|
|
1144
|
-
edge: Group;
|
|
1145
|
-
other?: any;
|
|
1146
|
-
};
|
|
1147
|
-
export type UIHandler = (target: UI, pt: PtLike, type: string, evt: MouseEvent) => void;
|
|
1148
|
-
export type WarningType = "error" | "warn" | "mute";
|
|
1149
|
-
export type ITempoStartFn = (count: number) => void | boolean;
|
|
1150
|
-
export type ITempoProgressFn = (count: number, t: number, ms: number, start: boolean) => void | boolean;
|
|
1151
|
-
export type ITempoListener = {
|
|
1152
|
-
name?: string;
|
|
1153
|
-
beats?: number | number[];
|
|
1154
|
-
period?: number;
|
|
1155
|
-
duration?: number;
|
|
1156
|
-
offset?: number;
|
|
1157
|
-
continuous?: boolean;
|
|
1158
|
-
index?: number;
|
|
1159
|
-
fn: Function;
|
|
1160
|
-
};
|
|
1161
|
-
export type ITempoResponses = {
|
|
1162
|
-
start: (fn: ITempoStartFn, offset: number, name?: string) => string;
|
|
1163
|
-
progress: (fn: ITempoProgressFn, offset: number, name?: string) => string;
|
|
1164
|
-
};
|
|
1165
|
-
export type ISoundAnalyzer = {
|
|
1166
|
-
node: AnalyserNode;
|
|
1167
|
-
size: number;
|
|
1168
|
-
data: Uint8Array;
|
|
1169
|
-
};
|
|
1170
|
-
export type SoundType = "file" | "gen" | "input";
|
|
1171
|
-
export type DefaultFormStyle = {
|
|
1172
|
-
fillStyle?: string | CanvasGradient | CanvasPattern;
|
|
1173
|
-
strokeStyle?: string | CanvasGradient | CanvasPattern;
|
|
1174
|
-
lineWidth?: number;
|
|
1175
|
-
lineJoin?: string;
|
|
1176
|
-
lineCap?: string;
|
|
1177
|
-
globalAlpha?: number;
|
|
1178
|
-
};
|
|
1179
|
-
export type CanvasPatternRepetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
|
1196
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1180
1197
|
|
|
1181
|
-
|
|
1198
|
+
declare class Typography {
|
|
1182
1199
|
static textWidthEstimator(fn: (string: any) => number, samples?: string[], distribution?: number[]): (string: any) => number;
|
|
1183
1200
|
static truncate(fn: (string: any) => number, str: string, width: number, tail?: string): [string, number];
|
|
1184
1201
|
static fontSizeToBox(box: PtLikeIterable, ratio?: number, byHeight?: boolean): (GroupLike: any) => number;
|
|
1185
1202
|
static fontSizeToThreshold(threshold: number, direction?: number): (a: number, b: number) => number;
|
|
1186
1203
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
protected
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1204
|
+
|
|
1205
|
+
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
1206
|
+
|
|
1207
|
+
declare class World {
|
|
1208
|
+
private _lastTime;
|
|
1209
|
+
protected _gravity: Pt;
|
|
1210
|
+
protected _friction: number;
|
|
1211
|
+
protected _damping: number;
|
|
1212
|
+
protected _bound: Bound;
|
|
1213
|
+
protected _particles: Particle[];
|
|
1214
|
+
protected _bodies: Body[];
|
|
1215
|
+
protected _pnames: string[];
|
|
1216
|
+
protected _bnames: string[];
|
|
1217
|
+
protected _drawParticles: (p: Particle, i: number) => void;
|
|
1218
|
+
protected _drawBodies: (p: Body, i: number) => void;
|
|
1219
|
+
constructor(bound: PtIterable, friction?: number, gravity?: PtLike | number);
|
|
1220
|
+
get bound(): Bound;
|
|
1221
|
+
set bound(bound: Bound);
|
|
1222
|
+
get gravity(): Pt;
|
|
1223
|
+
set gravity(g: Pt);
|
|
1224
|
+
get friction(): number;
|
|
1225
|
+
set friction(f: number);
|
|
1226
|
+
get damping(): number;
|
|
1227
|
+
set damping(f: number);
|
|
1228
|
+
get bodyCount(): number;
|
|
1229
|
+
get particleCount(): number;
|
|
1230
|
+
body(id: number | string): any;
|
|
1231
|
+
particle(id: number | string): any;
|
|
1232
|
+
bodyIndex(name: string): number;
|
|
1233
|
+
particleIndex(name: string): number;
|
|
1234
|
+
update(ms: number): void;
|
|
1235
|
+
drawParticles(fn: (p: Particle, i: number) => void): void;
|
|
1236
|
+
drawBodies(fn: (p: Body, i: number) => void): void;
|
|
1237
|
+
add(p: Particle | Body, name?: string): this;
|
|
1238
|
+
private _index;
|
|
1239
|
+
removeBody(from: number | string, count?: number): this;
|
|
1240
|
+
removeParticle(from: number | string, count?: number): this;
|
|
1241
|
+
static edgeConstraint(p1: Particle, p2: Particle, dist: number, stiff?: number, precise?: boolean): Particle;
|
|
1242
|
+
static boundConstraint(p: Particle, rect: PtIterable, damping?: number): void;
|
|
1243
|
+
protected integrate(p: Particle, dt: number, prevDt?: number): Particle;
|
|
1244
|
+
protected _updateParticles(dt: number): void;
|
|
1245
|
+
protected _updateBodies(dt: number): void;
|
|
1246
|
+
}
|
|
1247
|
+
declare class Particle extends Pt {
|
|
1248
|
+
protected _mass: number;
|
|
1249
|
+
protected _radius: number;
|
|
1250
|
+
protected _force: Pt;
|
|
1251
|
+
protected _prev: Pt;
|
|
1252
|
+
protected _body: Body;
|
|
1253
|
+
protected _lock: boolean;
|
|
1254
|
+
protected _lockPt: Pt;
|
|
1255
|
+
constructor(...args: any[]);
|
|
1256
|
+
get mass(): number;
|
|
1257
|
+
set mass(m: number);
|
|
1258
|
+
get radius(): number;
|
|
1259
|
+
set radius(f: number);
|
|
1260
|
+
get previous(): Pt;
|
|
1261
|
+
set previous(p: Pt);
|
|
1262
|
+
get force(): Pt;
|
|
1263
|
+
set force(g: Pt);
|
|
1264
|
+
get body(): Body;
|
|
1265
|
+
set body(b: Body);
|
|
1266
|
+
get lock(): boolean;
|
|
1267
|
+
set lock(b: boolean);
|
|
1268
|
+
get changed(): Pt;
|
|
1269
|
+
set position(p: Pt);
|
|
1270
|
+
size(r: number): this;
|
|
1271
|
+
addForce(...args: any[]): Pt;
|
|
1272
|
+
verlet(dt: number, friction: number, lastDt?: number): this;
|
|
1273
|
+
hit(...args: any[]): this;
|
|
1274
|
+
collide(p2: Particle, damp?: number): void;
|
|
1252
1275
|
toString(): string;
|
|
1253
|
-
protected _within(p: PtLike): boolean;
|
|
1254
|
-
protected static _trigger(fns: UIHandler[], target: UI, pt: PtLike, type: string, evt: MouseEvent): void;
|
|
1255
|
-
protected static _addHandler(fns: UIHandler[], fn: UIHandler): number;
|
|
1256
|
-
protected static _removeHandler(fns: UIHandler[], index: number): boolean;
|
|
1257
|
-
}
|
|
1258
|
-
export class UIButton extends UI {
|
|
1259
|
-
constructor(group: PtLikeIterable, shape: string, states?: {
|
|
1260
|
-
[key: string]: any;
|
|
1261
|
-
}, id?: string);
|
|
1262
|
-
onClick(fn: UIHandler): number;
|
|
1263
|
-
offClick(id: number): boolean;
|
|
1264
|
-
onContextMenu(fn: UIHandler): number;
|
|
1265
|
-
offContextMenu(id: number): boolean;
|
|
1266
|
-
onHover(enter?: UIHandler, leave?: UIHandler): number[];
|
|
1267
|
-
offHover(enterID?: number, leaveID?: number): boolean[];
|
|
1268
1276
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
+
declare class Body extends Group {
|
|
1278
|
+
protected _cs: Array<number[]>;
|
|
1279
|
+
protected _stiff: number;
|
|
1280
|
+
protected _locks: {
|
|
1281
|
+
[index: string]: Particle;
|
|
1282
|
+
};
|
|
1283
|
+
protected _mass: number;
|
|
1284
|
+
constructor();
|
|
1285
|
+
static fromGroup(body: PtIterable, stiff?: number, autoLink?: boolean, autoMass?: boolean): Body;
|
|
1286
|
+
init(body: PtIterable, stiff?: number): this;
|
|
1287
|
+
get mass(): number;
|
|
1288
|
+
set mass(m: number);
|
|
1289
|
+
autoMass(): this;
|
|
1290
|
+
link(index1: number, index2: number, stiff?: number): this;
|
|
1291
|
+
linkAll(stiff: number): void;
|
|
1292
|
+
linksToLines(): Group[];
|
|
1293
|
+
processEdges(): void;
|
|
1294
|
+
processBody(b: Body): void;
|
|
1295
|
+
processParticle(b: Particle): void;
|
|
1277
1296
|
}
|
|
1278
1297
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
static
|
|
1314
|
-
static
|
|
1315
|
-
static
|
|
1316
|
-
|
|
1317
|
-
static
|
|
1318
|
-
|
|
1319
|
-
static
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1298
|
+
declare class Tempo implements IPlayer {
|
|
1299
|
+
protected _bpm: number;
|
|
1300
|
+
protected _ms: number;
|
|
1301
|
+
protected _listeners: {
|
|
1302
|
+
[key: string]: ITempoListener;
|
|
1303
|
+
};
|
|
1304
|
+
protected _listenerInc: number;
|
|
1305
|
+
animateID: string;
|
|
1306
|
+
constructor(bpm: number);
|
|
1307
|
+
static fromBeat(ms: number): Tempo;
|
|
1308
|
+
get bpm(): number;
|
|
1309
|
+
set bpm(n: number);
|
|
1310
|
+
get ms(): number;
|
|
1311
|
+
set ms(n: number);
|
|
1312
|
+
protected _createID(listener: ITempoListener | Function): string;
|
|
1313
|
+
every(beats: number | number[]): ITempoResponses;
|
|
1314
|
+
track(time: any): void;
|
|
1315
|
+
stop(name: string): void;
|
|
1316
|
+
animate(time: any, ftime: any): void;
|
|
1317
|
+
resize(bound: Bound, evt?: Event): void;
|
|
1318
|
+
action(type: string, px: number, py: number, evt: Event): void;
|
|
1319
|
+
}
|
|
1320
|
+
declare class Sound {
|
|
1321
|
+
private _type;
|
|
1322
|
+
_ctx: AudioContext;
|
|
1323
|
+
_node: AudioNode;
|
|
1324
|
+
_outputNode: AudioNode;
|
|
1325
|
+
_stream: MediaStream;
|
|
1326
|
+
_source: HTMLMediaElement;
|
|
1327
|
+
_buffer: AudioBuffer;
|
|
1328
|
+
analyzer: ISoundAnalyzer;
|
|
1329
|
+
protected _playing: boolean;
|
|
1330
|
+
protected _timestamp: number;
|
|
1331
|
+
constructor(type: SoundType);
|
|
1332
|
+
static from(node: AudioNode, ctx: AudioContext, type?: SoundType, stream?: MediaStream): Sound;
|
|
1333
|
+
static load(source: HTMLMediaElement | string, crossOrigin?: string): Promise<Sound>;
|
|
1334
|
+
static loadAsBuffer(url: string): Promise<Sound>;
|
|
1335
|
+
protected createBuffer(buf: AudioBuffer): this;
|
|
1336
|
+
static generate(type: OscillatorType, val: number | PeriodicWave): Sound;
|
|
1337
|
+
protected _gen(type: OscillatorType, val: number | PeriodicWave): Sound;
|
|
1338
|
+
static input(constraint?: MediaStreamConstraints): Promise<Sound>;
|
|
1339
|
+
get ctx(): AudioContext;
|
|
1340
|
+
get node(): AudioNode;
|
|
1341
|
+
get outputNode(): AudioNode;
|
|
1342
|
+
get stream(): MediaStream;
|
|
1343
|
+
get source(): HTMLMediaElement;
|
|
1344
|
+
get buffer(): AudioBuffer;
|
|
1345
|
+
set buffer(b: AudioBuffer);
|
|
1346
|
+
get type(): SoundType;
|
|
1347
|
+
get playing(): boolean;
|
|
1348
|
+
get progress(): number;
|
|
1349
|
+
get playable(): boolean;
|
|
1350
|
+
get binSize(): number;
|
|
1351
|
+
get sampleRate(): number;
|
|
1352
|
+
get frequency(): number;
|
|
1353
|
+
set frequency(f: number);
|
|
1354
|
+
connect(node: AudioNode): this;
|
|
1355
|
+
setOutputNode(outputNode: AudioNode): this;
|
|
1356
|
+
removeOutputNode(): this;
|
|
1357
|
+
analyze(size?: number, minDb?: number, maxDb?: number, smooth?: number): this;
|
|
1358
|
+
protected _domain(time: boolean): Uint8Array;
|
|
1359
|
+
protected _domainTo(time: boolean, size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
1360
|
+
timeDomain(): Uint8Array;
|
|
1361
|
+
timeDomainTo(size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
1362
|
+
freqDomain(): Uint8Array;
|
|
1363
|
+
freqDomainTo(size: PtLike, position?: PtLike, trim?: number[]): Group;
|
|
1364
|
+
reset(): this;
|
|
1365
|
+
start(timeAt?: number): this;
|
|
1366
|
+
stop(): this;
|
|
1367
|
+
toggle(): this;
|
|
1327
1368
|
}
|
|
1328
1369
|
|
|
1370
|
+
export { AnimateCallbackFn, Body, Bound, CanvasForm, CanvasPatternRepetition, CanvasSpace, CanvasSpaceOptions, Circle, Color, ColorType, Const, Create, Curve, DOMFormContext, DOMSpace, DefaultFormStyle, Delaunay, DelaunayMesh, DelaunayShape, Font, Form, Geom, Group, GroupLike, HTMLForm, HTMLSpace, IPlayer, IPt, ISoundAnalyzer, ISpacePlayers, ITempoListener, ITempoProgressFn, ITempoResponses, ITempoStartFn, ITimer, Img, IntersectContext, Line, Mat, MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, PtIterable, PtLike, PtLikeIterable, PtsCanvasRenderingContext2D, Range, Rectangle, SVGForm, SVGSpace, Shaping, Sound, SoundType, Space, Tempo, TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, WarningType, World };
|