pts 0.11.6 → 0.12.0
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/.eslintignore +5 -0
- package/.eslintrc.js +52 -0
- package/dist/index.d.mts +1380 -0
- package/dist/index.d.ts +26 -26
- package/dist/index.js +701 -707
- package/dist/index.mjs +701 -707
- package/dist/pts.js +701 -707
- package/dist/pts.min.js +3 -3
- package/dist/pts.min.js.map +1 -1
- package/package.json +10 -5
package/dist/index.d.ts
CHANGED
|
@@ -102,11 +102,11 @@ interface IPt {
|
|
|
102
102
|
z?: number;
|
|
103
103
|
w?: number;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
type PtLike = Pt | Float32Array | number[];
|
|
106
|
+
type GroupLike = Group | Pt[];
|
|
107
|
+
type PtIterable = GroupLike | Pt[] | Iterable<Pt>;
|
|
108
|
+
type PtLikeIterable = GroupLike | PtLike[] | Iterable<PtLike>;
|
|
109
|
+
type AnimateCallbackFn = (time?: number, frameTime?: number, currentSpace?: any) => void;
|
|
110
110
|
interface IPlayer {
|
|
111
111
|
animateID?: string;
|
|
112
112
|
animate?: AnimateCallbackFn;
|
|
@@ -123,7 +123,7 @@ interface ITimer {
|
|
|
123
123
|
end: number;
|
|
124
124
|
min: number;
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
type TouchPointsKey = "touches" | "changedTouches" | "targetTouches";
|
|
127
127
|
interface MultiTouchElement {
|
|
128
128
|
addEventListener(evt: any, callback: Function): any;
|
|
129
129
|
removeEventListener(evt: any, callback: Function): any;
|
|
@@ -135,25 +135,25 @@ interface PtsCanvasRenderingContext2D extends CanvasRenderingContext2D {
|
|
|
135
135
|
oBackingStorePixelRatio?: number;
|
|
136
136
|
backingStorePixelRatio?: number;
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
type CanvasSpaceOptions = {
|
|
139
139
|
bgcolor?: string;
|
|
140
140
|
resize?: boolean;
|
|
141
141
|
retina?: boolean;
|
|
142
142
|
offscreen?: boolean;
|
|
143
143
|
pixelDensity?: number;
|
|
144
144
|
};
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
type ColorType = "rgb" | "hsl" | "hsb" | "lab" | "lch" | "luv" | "xyz";
|
|
146
|
+
type DelaunayShape = {
|
|
147
147
|
i: number;
|
|
148
148
|
j: number;
|
|
149
149
|
k: number;
|
|
150
150
|
triangle: GroupLike;
|
|
151
151
|
circle: Group;
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
type DelaunayMesh = {
|
|
154
154
|
[key: string]: DelaunayShape;
|
|
155
155
|
}[];
|
|
156
|
-
|
|
156
|
+
type DOMFormContext = {
|
|
157
157
|
group: Element;
|
|
158
158
|
groupID: string;
|
|
159
159
|
groupCount: number;
|
|
@@ -161,7 +161,7 @@ declare type DOMFormContext = {
|
|
|
161
161
|
currentClass?: string;
|
|
162
162
|
style: object;
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
type IntersectContext = {
|
|
165
165
|
which: number;
|
|
166
166
|
dist: number;
|
|
167
167
|
normal: Pt;
|
|
@@ -169,11 +169,11 @@ declare type IntersectContext = {
|
|
|
169
169
|
edge: Group;
|
|
170
170
|
other?: any;
|
|
171
171
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
type UIHandler = (target: UI, pt: PtLike, type: string, evt: MouseEvent) => void;
|
|
173
|
+
type WarningType = "error" | "warn" | "mute";
|
|
174
|
+
type ITempoStartFn = (count: number) => void | boolean;
|
|
175
|
+
type ITempoProgressFn = (count: number, t: number, ms: number, start: boolean) => void | boolean;
|
|
176
|
+
type ITempoListener = {
|
|
177
177
|
name?: string;
|
|
178
178
|
beats?: number | number[];
|
|
179
179
|
period?: number;
|
|
@@ -183,17 +183,17 @@ declare type ITempoListener = {
|
|
|
183
183
|
index?: number;
|
|
184
184
|
fn: Function;
|
|
185
185
|
};
|
|
186
|
-
|
|
186
|
+
type ITempoResponses = {
|
|
187
187
|
start: (fn: ITempoStartFn, offset: number, name?: string) => string;
|
|
188
188
|
progress: (fn: ITempoProgressFn, offset: number, name?: string) => string;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
type ISoundAnalyzer = {
|
|
191
191
|
node: AnalyserNode;
|
|
192
192
|
size: number;
|
|
193
193
|
data: Uint8Array;
|
|
194
194
|
};
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
type SoundType = "file" | "gen" | "input";
|
|
196
|
+
type DefaultFormStyle = {
|
|
197
197
|
fillStyle?: string | CanvasGradient | CanvasPattern;
|
|
198
198
|
strokeStyle?: string | CanvasGradient | CanvasPattern;
|
|
199
199
|
lineWidth?: number;
|
|
@@ -201,7 +201,7 @@ declare type DefaultFormStyle = {
|
|
|
201
201
|
lineCap?: string;
|
|
202
202
|
globalAlpha?: number;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
type CanvasPatternRepetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
|
205
205
|
|
|
206
206
|
/*! Pts.js is licensed under Apache License 2.0. Copyright © 2017-current William Ngan and contributors. (https://github.com/williamngan/pts) */
|
|
207
207
|
|
|
@@ -552,7 +552,7 @@ declare class Img {
|
|
|
552
552
|
static loadPattern(src: string, space: CanvasSpace, repeat?: CanvasPatternRepetition, editable?: boolean): Promise<CanvasPattern>;
|
|
553
553
|
static blank(size: PtLike, space: CanvasSpace, scale?: number): Img;
|
|
554
554
|
load(src: string): Promise<Img>;
|
|
555
|
-
protected _drawToScale(canvasScale: number | PtLike, img:
|
|
555
|
+
protected _drawToScale(canvasScale: number | PtLike, img: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | HTMLVideoElement): void;
|
|
556
556
|
initCanvas(width: number, height: number, canvasScale?: number | PtLike): void;
|
|
557
557
|
bitmap(size?: PtLike): Promise<ImageBitmap>;
|
|
558
558
|
pattern(reptition?: CanvasPatternRepetition, dynamic?: boolean): CanvasPattern;
|
|
@@ -1236,8 +1236,8 @@ declare class World {
|
|
|
1236
1236
|
set iterations(f: number);
|
|
1237
1237
|
get bodyCount(): number;
|
|
1238
1238
|
get particleCount(): number;
|
|
1239
|
-
body(id: number | string):
|
|
1240
|
-
particle(id: number | string):
|
|
1239
|
+
body(id: number | string): Body;
|
|
1240
|
+
particle(id: number | string): Particle;
|
|
1241
1241
|
bodyIndex(name: string): number;
|
|
1242
1242
|
particleIndex(name: string): number;
|
|
1243
1243
|
update(ms: number): void;
|
|
@@ -1377,4 +1377,4 @@ declare class Sound {
|
|
|
1377
1377
|
toggle(): this;
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
|
-
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 };
|
|
1380
|
+
export { type AnimateCallbackFn, Body, Bound, CanvasForm, type CanvasPatternRepetition, CanvasSpace, type CanvasSpaceOptions, Circle, Color, type ColorType, Const, Create, Curve, type DOMFormContext, DOMSpace, type DefaultFormStyle, Delaunay, type DelaunayMesh, type DelaunayShape, Font, Form, Geom, Group, type GroupLike, HTMLForm, HTMLSpace, type IPlayer, type IPt, type ISoundAnalyzer, type ISpacePlayers, type ITempoListener, type ITempoProgressFn, type ITempoResponses, type ITempoStartFn, type ITimer, Img, type IntersectContext, Line, Mat, type MultiTouchElement, MultiTouchSpace, Noise, Num, Particle, Polygon, Pt, type PtIterable, type PtLike, type PtLikeIterable, type PtsCanvasRenderingContext2D, Range, Rectangle, SVGForm, SVGSpace, Shaping, Sound, type SoundType, Space, Tempo, type TouchPointsKey, Triangle, Typography, UI, UIButton, UIDragger, type UIHandler, UIPointerActions, UIShape, Util, Vec, VisualForm, type WarningType, World };
|