q5 4.0.1 → 4.2.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/README.md +6 -23
- package/deno.json +1 -1
- package/package.json +1 -2
- package/q5.d.ts +263 -48
- package/q5.js +199 -51
- package/q5.min.js +2 -2
package/README.md
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Visit [q5js.org](https://q5js.org)! 💫
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
5
|
+
q5 was designed to make creative coding fun and accessible for educators, artists, designers, and beginners. 🤝
|
|
6
|
+
|
|
7
|
+
- 100x faster than [p5.js][] ⚡️
|
|
8
8
|
- beginner friendly [documentation](https://q5js.org/learn) 📚
|
|
9
9
|
- compatible with popular addons, including [p5.sound][], [ml5.js][], and [p5play][] 🎮
|
|
10
10
|
- no dependencies, ~140kb minified 📦
|
|
11
|
-
- free
|
|
12
|
-
|
|
13
|
-
q5 was designed to make creative coding fun and accessible for educators, artists, designers, and beginners. 🤝
|
|
14
|
-
|
|
15
|
-
Familiar with p5? You'll be right at home with q5. It's like getting a free computer upgrade! 🖥️
|
|
11
|
+
- free and open source 🆓
|
|
16
12
|
|
|
17
13
|
```js
|
|
18
14
|
await Canvas(200);
|
|
@@ -21,23 +17,10 @@ circle(0, 0, 80);
|
|
|
21
17
|
|
|
22
18
|
## Documentation
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
The [q5 learn pages](https://q5js.org/learn) are organized into sections with interactive mini-examples.
|
|
25
21
|
|
|
26
22
|
See the [wiki](https://github.com/q5js/q5.js/wiki) for extended documentation.
|
|
27
23
|
|
|
28
|
-
Use the [q5.d.ts](q5.d.ts) file in Visual Studio Code to get autocompletion and inline hover-over documentation. Simply add this `jsconfig.json` file to your project folder:
|
|
29
|
-
|
|
30
|
-
```json
|
|
31
|
-
{
|
|
32
|
-
"compilerOptions": {
|
|
33
|
-
"target": "ESNext"
|
|
34
|
-
},
|
|
35
|
-
"typeAcquisition": {
|
|
36
|
-
"include": ["node_modules/q5"]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
24
|
## Support q5 💙
|
|
42
25
|
|
|
43
26
|
q5 is open source and anyone can use it for free under the terms of the LGPL. 🎉
|
|
@@ -54,7 +37,7 @@ All contributors must agree to the [code of conduct](CODE_OF_CONDUCT.md).
|
|
|
54
37
|
|
|
55
38
|
## Licensing
|
|
56
39
|
|
|
57
|
-
q5.js was created by [Quinton Ashley](https://github.com/quinton-ashley) and [contributors](https://github.com/q5js/q5.js/graphs/contributors). It is open source licensed under the LGPLv3.
|
|
40
|
+
q5.js was created by [Quinton Ashley](https://github.com/quinton-ashley) and [contributors](https://github.com/q5js/q5.js/graphs/contributors). It is free to use and open source licensed under the LGPLv3.
|
|
58
41
|
|
|
59
42
|
@LingDong- created the original q5xjs library which is Unlicense (public domain) licensed.
|
|
60
43
|
|
package/deno.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "q5",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Beginner friendly graphics powered by WebGPU, optimized for interactive art!",
|
|
5
5
|
"author": "quinton-ashley",
|
|
6
6
|
"contributors": [
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"bundle": "cat src/q5-core.js src/q5-canvas.js src/q5-c2d-canvas.js src/q5-c2d-shapes.js src/q5-c2d-image.js src/q5-c2d-soft-filters.js src/q5-c2d-text.js src/q5-color.js src/q5-display.js src/q5-dom.js src/q5-fes.js src/q5-input.js src/q5-math.js src/q5-record.js src/q5-sound.js src/q5-util.js src/q5-vector.js src/q5-webgpu.js src/q5-lang.js > q5.js",
|
|
33
33
|
"min": "terser q5.js --compress ecma=2025 --mangle > q5.min.js",
|
|
34
34
|
"dist": "bun bundle && bun min",
|
|
35
|
-
"dist-p5play": "bun dist && cp q5.js ../../web/p5play-web/v3/q5.js && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
|
|
36
35
|
"tests": "jest test",
|
|
37
36
|
"bld": "node lang/build.js",
|
|
38
37
|
"dts": "node lang/types.js",
|
package/q5.d.ts
CHANGED
|
@@ -540,7 +540,7 @@ declare global {
|
|
|
540
540
|
* and the bottom right pixel's data is at the end, going from
|
|
541
541
|
* left to right and top to bottom.
|
|
542
542
|
*/
|
|
543
|
-
|
|
543
|
+
let pixels: number[];
|
|
544
544
|
|
|
545
545
|
/** 🌆
|
|
546
546
|
* Loads pixel data into `pixels` from the canvas or image.
|
|
@@ -1329,25 +1329,25 @@ declare global {
|
|
|
1329
1329
|
function touchMoved(): void;
|
|
1330
1330
|
|
|
1331
1331
|
/** 🖲
|
|
1332
|
-
*
|
|
1332
|
+
* Array containing all current pointers within the
|
|
1333
1333
|
* browser window.
|
|
1334
1334
|
*
|
|
1335
|
-
* This includes mouse,
|
|
1335
|
+
* This includes mouse, pen, and touch interactions.
|
|
1336
1336
|
*
|
|
1337
1337
|
* Each pointer is an object with
|
|
1338
1338
|
* `event`, `x`, and `y` properties.
|
|
1339
|
-
*
|
|
1340
|
-
*
|
|
1339
|
+
*
|
|
1340
|
+
* The `event` property contains the most recent
|
|
1341
|
+
* [PointerEvent](https://developer.mozilla.org/docs/Web/API/PointerEvent) associated with the pointer, which includes additional information such as the pointer type.
|
|
1341
1342
|
* @example
|
|
1342
1343
|
* q5.draw = function () {
|
|
1343
1344
|
* background(0.8);
|
|
1344
|
-
* for (let
|
|
1345
|
-
* let pointer = pointers[pointerID];
|
|
1345
|
+
* for (let pointer of pointers) {
|
|
1346
1346
|
* circle(pointer.x, pointer.y, 100);
|
|
1347
1347
|
* }
|
|
1348
1348
|
* };
|
|
1349
1349
|
*/
|
|
1350
|
-
let pointers:
|
|
1350
|
+
let pointers: [];
|
|
1351
1351
|
|
|
1352
1352
|
/** 🖲
|
|
1353
1353
|
* Sets the cursor to a [CSS cursor type](https://developer.mozilla.org/docs/Web/CSS/cursor) or image.
|
|
@@ -1378,7 +1378,8 @@ declare global {
|
|
|
1378
1378
|
*
|
|
1379
1379
|
* Return true to allow the default behavior of scrolling the page.
|
|
1380
1380
|
* @example
|
|
1381
|
-
* let x =
|
|
1381
|
+
* let x = 0;
|
|
1382
|
+
* let y = 0;
|
|
1382
1383
|
* q5.draw = function () {
|
|
1383
1384
|
* circle(x, y, 10);
|
|
1384
1385
|
* };
|
|
@@ -1390,6 +1391,28 @@ declare global {
|
|
|
1390
1391
|
*/
|
|
1391
1392
|
function mouseWheel(event: any): void;
|
|
1392
1393
|
|
|
1394
|
+
/** 🖲
|
|
1395
|
+
* Distance the mouse has moved since the last frame in the horizontal direction.
|
|
1396
|
+
* @example
|
|
1397
|
+
* q5.draw = function () {
|
|
1398
|
+
* background(0.8);
|
|
1399
|
+
* if (movedX > 0) text('>>', 0, 0);
|
|
1400
|
+
* if (movedX < 0) text('<<', 0, 0);
|
|
1401
|
+
* };
|
|
1402
|
+
*/
|
|
1403
|
+
let movedX: number;
|
|
1404
|
+
|
|
1405
|
+
/** 🖲
|
|
1406
|
+
* Distance the mouse has moved since the last frame in the vertical direction.
|
|
1407
|
+
* @example
|
|
1408
|
+
* q5.draw = function () {
|
|
1409
|
+
* background(0.8);
|
|
1410
|
+
* if (movedY > 0) text('vv', 0, 0);
|
|
1411
|
+
* if (movedY < 0) text('^^', 0, 0);
|
|
1412
|
+
* };
|
|
1413
|
+
*/
|
|
1414
|
+
let movedY: number;
|
|
1415
|
+
|
|
1393
1416
|
/** 🖲
|
|
1394
1417
|
* Requests that the pointer be locked to the document body, hiding
|
|
1395
1418
|
* the cursor and allowing for unlimited movement.
|
|
@@ -1949,7 +1972,7 @@ declare global {
|
|
|
1949
1972
|
*
|
|
1950
1973
|
* Not available in q5 WebGPU.
|
|
1951
1974
|
*/
|
|
1952
|
-
|
|
1975
|
+
let ctx: CanvasRenderingContext2D;
|
|
1953
1976
|
|
|
1954
1977
|
/** 💅
|
|
1955
1978
|
* Checks if a given point is within the current path's fill area.
|
|
@@ -2202,7 +2225,7 @@ declare global {
|
|
|
2202
2225
|
* text(windowWidth, 0, 0);
|
|
2203
2226
|
* };
|
|
2204
2227
|
*/
|
|
2205
|
-
|
|
2228
|
+
let windowWidth: number;
|
|
2206
2229
|
|
|
2207
2230
|
/** 💻
|
|
2208
2231
|
* The height of the window.
|
|
@@ -2214,7 +2237,7 @@ declare global {
|
|
|
2214
2237
|
* text(windowHeight, 0, 0);
|
|
2215
2238
|
* };
|
|
2216
2239
|
*/
|
|
2217
|
-
|
|
2240
|
+
let windowHeight: number;
|
|
2218
2241
|
|
|
2219
2242
|
/** 💻
|
|
2220
2243
|
* The width of the canvas.
|
|
@@ -2222,7 +2245,7 @@ declare global {
|
|
|
2222
2245
|
* await Canvas(200, 120);
|
|
2223
2246
|
* circle(0, 0, width);
|
|
2224
2247
|
*/
|
|
2225
|
-
|
|
2248
|
+
let width: number;
|
|
2226
2249
|
|
|
2227
2250
|
/** 💻
|
|
2228
2251
|
* The height of the canvas.
|
|
@@ -2230,7 +2253,7 @@ declare global {
|
|
|
2230
2253
|
* await Canvas(200, 80);
|
|
2231
2254
|
* circle(0, 0, height);
|
|
2232
2255
|
*/
|
|
2233
|
-
|
|
2256
|
+
let height: number;
|
|
2234
2257
|
|
|
2235
2258
|
/** 💻
|
|
2236
2259
|
* Half the width of the canvas.
|
|
@@ -2238,7 +2261,7 @@ declare global {
|
|
|
2238
2261
|
* await Canvas(200, 80);
|
|
2239
2262
|
* circle(0, 0, halfWidth);
|
|
2240
2263
|
*/
|
|
2241
|
-
|
|
2264
|
+
let halfWidth: number;
|
|
2242
2265
|
|
|
2243
2266
|
/** 💻
|
|
2244
2267
|
* Half the height of the canvas.
|
|
@@ -2246,12 +2269,12 @@ declare global {
|
|
|
2246
2269
|
* await Canvas(200, 80);
|
|
2247
2270
|
* circle(0, 0, halfHeight);
|
|
2248
2271
|
*/
|
|
2249
|
-
|
|
2272
|
+
let halfHeight: number;
|
|
2250
2273
|
|
|
2251
2274
|
/** 💻
|
|
2252
2275
|
* The canvas element associated with the Q5 instance.
|
|
2253
2276
|
*/
|
|
2254
|
-
|
|
2277
|
+
let canvas: HTMLCanvasElement;
|
|
2255
2278
|
|
|
2256
2279
|
/** 💻
|
|
2257
2280
|
* Resizes the canvas to the specified width and height.
|
|
@@ -2279,7 +2302,7 @@ declare global {
|
|
|
2279
2302
|
* text(frameCount, -92, 20);
|
|
2280
2303
|
* };
|
|
2281
2304
|
*/
|
|
2282
|
-
|
|
2305
|
+
let frameCount: number;
|
|
2283
2306
|
|
|
2284
2307
|
/** 💻
|
|
2285
2308
|
* Stops the draw loop.
|
|
@@ -2445,7 +2468,7 @@ declare global {
|
|
|
2445
2468
|
* circle(x, 0, 20);
|
|
2446
2469
|
* };
|
|
2447
2470
|
*/
|
|
2448
|
-
|
|
2471
|
+
let deltaTime: number;
|
|
2449
2472
|
|
|
2450
2473
|
// 🧮 math
|
|
2451
2474
|
|
|
@@ -3070,7 +3093,7 @@ declare global {
|
|
|
3070
3093
|
* @example
|
|
3071
3094
|
* await Canvas(200, 100);
|
|
3072
3095
|
*
|
|
3073
|
-
* let img = createImg('/assets/
|
|
3096
|
+
* let img = createImg('/assets/q5play_logo.avif');
|
|
3074
3097
|
* img.position(0, 0).size(100, 100);
|
|
3075
3098
|
*/
|
|
3076
3099
|
function createImg(src: string): HTMLImageElement;
|
|
@@ -3348,7 +3371,7 @@ declare global {
|
|
|
3348
3371
|
/** 🎞
|
|
3349
3372
|
* True if the canvas is currently being recorded.
|
|
3350
3373
|
*/
|
|
3351
|
-
|
|
3374
|
+
let recording: boolean;
|
|
3352
3375
|
|
|
3353
3376
|
// 🛠 utilities
|
|
3354
3377
|
|
|
@@ -3874,22 +3897,22 @@ declare global {
|
|
|
3874
3897
|
*/
|
|
3875
3898
|
|
|
3876
3899
|
/** ⚡
|
|
3877
|
-
* Creates a shader that q5 can use
|
|
3900
|
+
* Creates a shader that q5's WebGPU renderer can use.
|
|
3901
|
+
*
|
|
3902
|
+
* If `type` is not specified, this function customizes a copy of the [default shapes shader](https://github.com/q5js/q5.js/blob/main/src/shaders/shapes.wgsl), which affects the following functions:
|
|
3878
3903
|
*
|
|
3879
|
-
* Affects the following functions:
|
|
3880
3904
|
* `triangle`, `quad`, `plane`,
|
|
3881
3905
|
* `curve`, `bezier`, `beginShape`/`endShape`,
|
|
3882
3906
|
* and `background` (unless an image is used).
|
|
3883
3907
|
*
|
|
3884
|
-
* Use this function to customize a copy of the
|
|
3885
|
-
* [default shapes shader](https://github.com/q5js/q5.js/blob/main/src/shaders/shapes.wgsl).
|
|
3886
|
-
*
|
|
3887
3908
|
* For more information on the vertex and fragment function
|
|
3888
3909
|
* input parameters, data, and helper functions made available for use
|
|
3889
3910
|
* in your custom shader code, read the
|
|
3890
3911
|
* ["Custom Shaders in q5 WebGPU"](https://github.com/q5js/q5.js/wiki/Custom-Shaders-in-q5-WebGPU)
|
|
3891
3912
|
* wiki page.
|
|
3892
3913
|
* @param {string} code WGSL shader code excerpt
|
|
3914
|
+
* @param {string} [type] defaults to "shapes"
|
|
3915
|
+
* @param {Float32Array} [data] only for use with [fully custom shaders](https://github.com/q5js/q5.js/wiki/Custom-Shaders-in-q5-WebGPU#fully-custom-shaders)
|
|
3893
3916
|
* @returns {GPUShaderModule} a shader program
|
|
3894
3917
|
* @example
|
|
3895
3918
|
* await Canvas(200);
|
|
@@ -3928,7 +3951,7 @@ declare global {
|
|
|
3928
3951
|
* triangle(-50, -50, 0, 50, 50, -50);
|
|
3929
3952
|
* };
|
|
3930
3953
|
*/
|
|
3931
|
-
function createShader(code: string): GPUShaderModule;
|
|
3954
|
+
function createShader(code: string, type?: string, data?: Float32Array | {}): GPUShaderModule;
|
|
3932
3955
|
|
|
3933
3956
|
/** ⚡
|
|
3934
3957
|
* A plane is a centered rectangle with no stroke.
|
|
@@ -4049,6 +4072,7 @@ declare global {
|
|
|
4049
4072
|
* shader(grate);
|
|
4050
4073
|
* image(logo, 0, 0, 180, 180);
|
|
4051
4074
|
* };
|
|
4075
|
+
* //
|
|
4052
4076
|
*/
|
|
4053
4077
|
function createImageShader(code: string): GPUShaderModule;
|
|
4054
4078
|
|
|
@@ -4206,7 +4230,7 @@ declare global {
|
|
|
4206
4230
|
* A WebGPU memory allocation limit.
|
|
4207
4231
|
*
|
|
4208
4232
|
* The maximum number of transformation matrixes
|
|
4209
|
-
* that can be used
|
|
4233
|
+
* that can be used per frame.
|
|
4210
4234
|
*/
|
|
4211
4235
|
static MAX_TRANSFORMS: number;
|
|
4212
4236
|
|
|
@@ -4215,7 +4239,7 @@ declare global {
|
|
|
4215
4239
|
*
|
|
4216
4240
|
* The maximum number of rectangles
|
|
4217
4241
|
* (calls to `rect`, `square`, `capsule`)
|
|
4218
|
-
* that can be drawn
|
|
4242
|
+
* that can be drawn per frame.
|
|
4219
4243
|
*/
|
|
4220
4244
|
static MAX_RECTS: number;
|
|
4221
4245
|
|
|
@@ -4224,7 +4248,7 @@ declare global {
|
|
|
4224
4248
|
*
|
|
4225
4249
|
* The maximum number of ellipses
|
|
4226
4250
|
* (calls to `ellipse`, `circle`, and `arc`)
|
|
4227
|
-
* that can be drawn
|
|
4251
|
+
* that can be drawn per frame.
|
|
4228
4252
|
*/
|
|
4229
4253
|
static MAX_ELLIPSES: number;
|
|
4230
4254
|
|
|
@@ -4232,7 +4256,7 @@ declare global {
|
|
|
4232
4256
|
* A WebGPU memory allocation limit.
|
|
4233
4257
|
*
|
|
4234
4258
|
* The maximum number of text characters
|
|
4235
|
-
* that can be drawn
|
|
4259
|
+
* that can be drawn per frame.
|
|
4236
4260
|
*/
|
|
4237
4261
|
static MAX_CHARS: number;
|
|
4238
4262
|
|
|
@@ -4240,7 +4264,7 @@ declare global {
|
|
|
4240
4264
|
* A WebGPU memory allocation limit.
|
|
4241
4265
|
*
|
|
4242
4266
|
* The maximum number of separate calls to `text`
|
|
4243
|
-
* that can be drawn
|
|
4267
|
+
* that can be drawn per frame.
|
|
4244
4268
|
*/
|
|
4245
4269
|
static MAX_TEXTS: number;
|
|
4246
4270
|
|
|
@@ -4264,14 +4288,6 @@ declare global {
|
|
|
4264
4288
|
* Inside the function, `this` refers to the Q5 instance.
|
|
4265
4289
|
* @param {string} lifecycle 'init', 'presetup', 'postsetup', 'predraw', 'postdraw', or 'remove'
|
|
4266
4290
|
* @param {Function} fn The function to be run at the specified lifecycle phase.
|
|
4267
|
-
* @example
|
|
4268
|
-
* Q5.addHook('predraw', function () {
|
|
4269
|
-
* this.background('cyan');
|
|
4270
|
-
* });
|
|
4271
|
-
*
|
|
4272
|
-
* q5.draw = function () {
|
|
4273
|
-
* circle(mouseX, mouseY, 80);
|
|
4274
|
-
* };
|
|
4275
4291
|
*/
|
|
4276
4292
|
static addHook(lifecycle: string, fn: Function): void;
|
|
4277
4293
|
|
|
@@ -4294,7 +4310,7 @@ declare global {
|
|
|
4294
4310
|
/** ⚙
|
|
4295
4311
|
* The q5 draw function is run 60 times per second by default.
|
|
4296
4312
|
*/
|
|
4297
|
-
draw(): void;
|
|
4313
|
+
static draw(): void;
|
|
4298
4314
|
|
|
4299
4315
|
/** ⚙
|
|
4300
4316
|
* Runs after each `draw` function call and post-draw q5 addon processes, if any.
|
|
@@ -4304,13 +4320,199 @@ declare global {
|
|
|
4304
4320
|
* addons like p5play that auto-draw to the canvas after the `draw`
|
|
4305
4321
|
* function is run.
|
|
4306
4322
|
*/
|
|
4307
|
-
postProcess(): void;
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4323
|
+
static postProcess(): void;
|
|
4324
|
+
//-
|
|
4325
|
+
static update(): void;
|
|
4326
|
+
update(): void;
|
|
4327
|
+
draw(): void;
|
|
4328
|
+
postProcess(): void;
|
|
4329
|
+
Canvas: typeof Canvas;
|
|
4330
|
+
log: typeof log;
|
|
4331
|
+
circle: typeof circle;
|
|
4332
|
+
ellipse: typeof ellipse;
|
|
4333
|
+
rect: typeof rect;
|
|
4334
|
+
square: typeof square;
|
|
4335
|
+
point: typeof point;
|
|
4336
|
+
line: typeof line;
|
|
4337
|
+
capsule: typeof capsule;
|
|
4338
|
+
rectMode: typeof rectMode;
|
|
4339
|
+
ellipseMode: typeof ellipseMode;
|
|
4340
|
+
loadImage: typeof loadImage;
|
|
4341
|
+
image: typeof image;
|
|
4342
|
+
imageMode: typeof imageMode;
|
|
4343
|
+
defaultImageScale: typeof defaultImageScale;
|
|
4344
|
+
resize: typeof resize;
|
|
4345
|
+
trim: typeof trim;
|
|
4346
|
+
smooth: typeof smooth;
|
|
4347
|
+
noSmooth: typeof noSmooth;
|
|
4348
|
+
tint: typeof tint;
|
|
4349
|
+
noTint: typeof noTint;
|
|
4350
|
+
mask: typeof mask;
|
|
4351
|
+
copy: typeof copy;
|
|
4352
|
+
inset: typeof inset;
|
|
4353
|
+
get: typeof get;
|
|
4354
|
+
set: typeof set;
|
|
4355
|
+
loadPixels: typeof loadPixels;
|
|
4356
|
+
updatePixels: typeof updatePixels;
|
|
4357
|
+
filter: typeof filter;
|
|
4358
|
+
createImage: typeof createImage;
|
|
4359
|
+
createGraphics: typeof createGraphics;
|
|
4360
|
+
text: typeof text;
|
|
4361
|
+
loadFont: typeof loadFont;
|
|
4362
|
+
textFont: typeof textFont;
|
|
4363
|
+
textSize: typeof textSize;
|
|
4364
|
+
textLeading: typeof textLeading;
|
|
4365
|
+
textStyle: typeof textStyle;
|
|
4366
|
+
textAlign: typeof textAlign;
|
|
4367
|
+
textWeight: typeof textWeight;
|
|
4368
|
+
textWidth: typeof textWidth;
|
|
4369
|
+
textAscent: typeof textAscent;
|
|
4370
|
+
textDescent: typeof textDescent;
|
|
4371
|
+
createTextImage: typeof createTextImage;
|
|
4372
|
+
textImage: typeof textImage;
|
|
4373
|
+
textToPoints: typeof textToPoints;
|
|
4374
|
+
nf: typeof nf;
|
|
4375
|
+
mousePressed: typeof mousePressed;
|
|
4376
|
+
mouseReleased: typeof mouseReleased;
|
|
4377
|
+
mouseMoved: typeof mouseMoved;
|
|
4378
|
+
mouseDragged: typeof mouseDragged;
|
|
4379
|
+
doubleClicked: typeof doubleClicked;
|
|
4380
|
+
keyIsDown: typeof keyIsDown;
|
|
4381
|
+
keyPressed: typeof keyPressed;
|
|
4382
|
+
keyReleased: typeof keyReleased;
|
|
4383
|
+
touchStarted: typeof touchStarted;
|
|
4384
|
+
touchEnded: typeof touchEnded;
|
|
4385
|
+
touchMoved: typeof touchMoved;
|
|
4386
|
+
cursor: typeof cursor;
|
|
4387
|
+
noCursor: typeof noCursor;
|
|
4388
|
+
mouseWheel: typeof mouseWheel;
|
|
4389
|
+
pointerLock: typeof pointerLock;
|
|
4390
|
+
color: typeof color;
|
|
4391
|
+
colorMode: typeof colorMode;
|
|
4392
|
+
background: typeof background;
|
|
4393
|
+
fill: typeof fill;
|
|
4394
|
+
stroke: typeof stroke;
|
|
4395
|
+
noFill: typeof noFill;
|
|
4396
|
+
noStroke: typeof noStroke;
|
|
4397
|
+
strokeWeight: typeof strokeWeight;
|
|
4398
|
+
opacity: typeof opacity;
|
|
4399
|
+
shadow: typeof shadow;
|
|
4400
|
+
noShadow: typeof noShadow;
|
|
4401
|
+
shadowBox: typeof shadowBox;
|
|
4402
|
+
blendMode: typeof blendMode;
|
|
4403
|
+
strokeCap: typeof strokeCap;
|
|
4404
|
+
strokeJoin: typeof strokeJoin;
|
|
4405
|
+
erase: typeof erase;
|
|
4406
|
+
noErase: typeof noErase;
|
|
4407
|
+
pushStyles: typeof pushStyles;
|
|
4408
|
+
popStyles: typeof popStyles;
|
|
4409
|
+
clear: typeof clear;
|
|
4410
|
+
inFill: typeof inFill;
|
|
4411
|
+
inStroke: typeof inStroke;
|
|
4412
|
+
translate: typeof translate;
|
|
4413
|
+
rotate: typeof rotate;
|
|
4414
|
+
scale: typeof scale;
|
|
4415
|
+
shearX: typeof shearX;
|
|
4416
|
+
shearY: typeof shearY;
|
|
4417
|
+
applyMatrix: typeof applyMatrix;
|
|
4418
|
+
resetMatrix: typeof resetMatrix;
|
|
4419
|
+
pushMatrix: typeof pushMatrix;
|
|
4420
|
+
popMatrix: typeof popMatrix;
|
|
4421
|
+
push: typeof push;
|
|
4422
|
+
pop: typeof pop;
|
|
4423
|
+
displayMode: typeof displayMode;
|
|
4424
|
+
fullscreen: typeof fullscreen;
|
|
4425
|
+
resizeCanvas: typeof resizeCanvas;
|
|
4426
|
+
noLoop: typeof noLoop;
|
|
4427
|
+
redraw: typeof redraw;
|
|
4428
|
+
loop: typeof loop;
|
|
4429
|
+
frameRate: typeof frameRate;
|
|
4430
|
+
getTargetFrameRate: typeof getTargetFrameRate;
|
|
4431
|
+
getFPS: typeof getFPS;
|
|
4432
|
+
pixelDensity: typeof pixelDensity;
|
|
4433
|
+
displayDensity: typeof displayDensity;
|
|
4434
|
+
random: typeof random;
|
|
4435
|
+
jit: typeof jit;
|
|
4436
|
+
noise: typeof noise;
|
|
4437
|
+
dist: typeof dist;
|
|
4438
|
+
map: typeof map;
|
|
4439
|
+
angleMode: typeof angleMode;
|
|
4440
|
+
radians: typeof radians;
|
|
4441
|
+
degrees: typeof degrees;
|
|
4442
|
+
lerp: typeof lerp;
|
|
4443
|
+
constrain: typeof constrain;
|
|
4444
|
+
norm: typeof norm;
|
|
4445
|
+
abs: typeof abs;
|
|
4446
|
+
round: typeof round;
|
|
4447
|
+
ceil: typeof ceil;
|
|
4448
|
+
floor: typeof floor;
|
|
4449
|
+
min: typeof min;
|
|
4450
|
+
max: typeof max;
|
|
4451
|
+
sin: typeof sin;
|
|
4452
|
+
cos: typeof cos;
|
|
4453
|
+
tan: typeof tan;
|
|
4454
|
+
mag: typeof mag;
|
|
4455
|
+
asin: typeof asin;
|
|
4456
|
+
acos: typeof acos;
|
|
4457
|
+
atan: typeof atan;
|
|
4458
|
+
atan2: typeof atan2;
|
|
4459
|
+
pow: typeof pow;
|
|
4460
|
+
fract: typeof fract;
|
|
4461
|
+
sq: typeof sq;
|
|
4462
|
+
sqrt: typeof sqrt;
|
|
4463
|
+
loge: typeof loge;
|
|
4464
|
+
exp: typeof exp;
|
|
4465
|
+
randomSeed: typeof randomSeed;
|
|
4466
|
+
randomGenerator: typeof randomGenerator;
|
|
4467
|
+
randomGaussian: typeof randomGaussian;
|
|
4468
|
+
randomExponential: typeof randomExponential;
|
|
4469
|
+
noiseMode: typeof noiseMode;
|
|
4470
|
+
noiseSeed: typeof noiseSeed;
|
|
4471
|
+
noiseDetail: typeof noiseDetail;
|
|
4472
|
+
loadSound: typeof loadSound;
|
|
4473
|
+
loadAudio: typeof loadAudio;
|
|
4474
|
+
getAudioContext: typeof getAudioContext;
|
|
4475
|
+
userStartAudio: typeof userStartAudio;
|
|
4476
|
+
createEl: typeof createEl;
|
|
4477
|
+
createA: typeof createA;
|
|
4478
|
+
createButton: typeof createButton;
|
|
4479
|
+
createCheckbox: typeof createCheckbox;
|
|
4480
|
+
createColorPicker: typeof createColorPicker;
|
|
4481
|
+
createImg: typeof createImg;
|
|
4482
|
+
createInput: typeof createInput;
|
|
4483
|
+
createP: typeof createP;
|
|
4484
|
+
createRadio: typeof createRadio;
|
|
4485
|
+
createSelect: typeof createSelect;
|
|
4486
|
+
createSlider: typeof createSlider;
|
|
4487
|
+
createVideo: typeof createVideo;
|
|
4488
|
+
createCapture: typeof createCapture;
|
|
4489
|
+
findEl: typeof findEl;
|
|
4490
|
+
findEls: typeof findEls;
|
|
4491
|
+
createRecorder: typeof createRecorder;
|
|
4492
|
+
record: typeof record;
|
|
4493
|
+
pauseRecording: typeof pauseRecording;
|
|
4494
|
+
deleteRecording: typeof deleteRecording;
|
|
4495
|
+
saveRecording: typeof saveRecording;
|
|
4496
|
+
load: typeof load;
|
|
4497
|
+
save: typeof save;
|
|
4498
|
+
loadText: typeof loadText;
|
|
4499
|
+
loadJSON: typeof loadJSON;
|
|
4500
|
+
loadCSV: typeof loadCSV;
|
|
4501
|
+
loadXML: typeof loadXML;
|
|
4502
|
+
loadAll: typeof loadAll;
|
|
4503
|
+
disablePreload: typeof disablePreload;
|
|
4504
|
+
shuffle: typeof shuffle;
|
|
4505
|
+
storeItem: typeof storeItem;
|
|
4506
|
+
getItem: typeof getItem;
|
|
4507
|
+
removeItem: typeof removeItem;
|
|
4508
|
+
clearStorage: typeof clearStorage;
|
|
4509
|
+
year: typeof year;
|
|
4510
|
+
day: typeof day;
|
|
4511
|
+
hour: typeof hour;
|
|
4512
|
+
minute: typeof minute;
|
|
4513
|
+
second: typeof second;
|
|
4514
|
+
static Image: {
|
|
4515
|
+
new (w: number, h: number, opt?: any): Q5.Image;
|
|
4314
4516
|
};
|
|
4315
4517
|
|
|
4316
4518
|
}
|
|
@@ -4319,7 +4521,20 @@ declare global {
|
|
|
4319
4521
|
interface Image {
|
|
4320
4522
|
width: number;
|
|
4321
4523
|
height: number;
|
|
4524
|
+
copy(): Q5.Image;
|
|
4525
|
+
get(x: number, y: number, w?: number, h?: number): Q5.Image | number[];
|
|
4526
|
+
set(x: number, y: number, val: any): void;
|
|
4527
|
+
resize(w: number, h: number): void;
|
|
4528
|
+
mask(img: Q5.Image): void;
|
|
4529
|
+
trim(): Q5.Image;
|
|
4530
|
+
filter(type: string, value?: number): void;
|
|
4531
|
+
loadPixels(): void;
|
|
4532
|
+
updatePixels(): void;
|
|
4533
|
+
save(fileName?: string): void;
|
|
4322
4534
|
}
|
|
4535
|
+
|
|
4536
|
+
export import Color = globalThis.Color;
|
|
4537
|
+
export import Vector = globalThis.Vector;
|
|
4323
4538
|
}
|
|
4324
4539
|
|
|
4325
4540
|
}
|