q5 2.17.0 → 2.18.3

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 CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## Visit [q5js.org](https://q5js.org)! 🌟
4
4
 
5
- [q5.js](https://q5js.org) is a spiritual successor to the [p5.js][] and [Processing Java][] graphics libraries.
5
+ [q5.js](https://q5js.org) is a sequel to the [p5.js][] and [Processing Java][] graphics libraries.
6
6
 
7
7
  - performance optimized for interactive art 🚀
8
8
  - includes a brand new renderer powered by WebGPU 💪
9
9
  - up to 32x faster than p5.js 🏎️
10
- - HDR color support 🌈
10
+ - beginner friendly API and documentation 📚
11
11
  - compatible with popular addons, including [p5.sound][] and [p5play][] 🎮
12
- - no dependencies, less than 100kb minified 📦
12
+ - no dependencies, ~100kb minified 📦
13
13
  - LGPL licensed (just like p5.js) 🆓
14
14
 
15
15
  q5.js was designed to make creative coding fun and accessible for a new generation of artists, designers, educators, and beginners. 🤝
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q5/q5",
3
- "version": "2.17.0",
3
+ "version": "2.18.1",
4
4
  "license": "LGPL-3.0",
5
5
  "description": "A sequel to p5.js that's optimized for interactive art",
6
6
  "author": "quinton-ashley",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q5",
3
- "version": "2.17.0",
3
+ "version": "2.18.3",
4
4
  "description": "A sequel to p5.js that's optimized for interactive art",
5
5
  "author": "quinton-ashley",
6
6
  "contributors": [
@@ -11,7 +11,7 @@
11
11
  "homepage": "https://q5js.org/home",
12
12
  "main": "q5-server.js",
13
13
  "scripts": {
14
- "bundle": "cat src/q5-core.js src/q5-canvas.js src/q5-c2d-canvas.js src/q5-c2d-drawing.js src/q5-c2d-image.js src/q5-c2d-soft-filters.js src/q5-c2d-text.js src/q5-ai.js src/q5-color.js src/q5-display.js src/q5-dom.js src/q5-input.js src/q5-math.js src/q5-sound.js src/q5-util.js src/q5-vector.js src/q5-webgpu-canvas.js src/q5-webgpu-drawing.js src/q5-webgpu-image.js src/q5-webgpu-text.js > q5.js",
14
+ "bundle": "cat src/q5-core.js src/q5-canvas.js src/q5-c2d-canvas.js src/q5-c2d-drawing.js src/q5-c2d-image.js src/q5-c2d-soft-filters.js src/q5-c2d-text.js src/q5-ai.js src/q5-color.js src/q5-display.js src/q5-dom.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-canvas.js src/q5-webgpu-drawing.js src/q5-webgpu-image.js src/q5-webgpu-text.js > q5.js",
15
15
  "min": "terser q5.js --compress ecma=2024 --mangle > q5.min.js",
16
16
  "dist": "bun bundle && bun min",
17
17
  "dist-p5play": "bun dist && cp q5.js ../../web/p5play-web/v3/q5.js && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
package/q5.d.ts CHANGED
@@ -7,6 +7,20 @@
7
7
  declare global {
8
8
  // ⭐️ core
9
9
 
10
+ /** ⭐️
11
+ * Welcome to q5's documentation! ☺️
12
+ *
13
+ * First time coding? Check out the [q5 Beginner's Guide to JavaScript](https://github.com/q5js/q5.js/wiki/q5-Beginner's-Guide-to-JavaScript).
14
+ *
15
+ * On these Learn pages you'll find concise descriptions for
16
+ * q5's functions and variables. Scroll through entire topics without
17
+ * needing to click between separate pages.
18
+ *
19
+ * Experiment with editing the code in the interactive mini examples,
20
+ * which are often only 8 lines of code or less. They automatically
21
+ * update as you type, so you can see results right away.
22
+ */
23
+
10
24
  /** ⭐️
11
25
  * The draw function is run 60 times per second by default.
12
26
  * @example
@@ -480,6 +494,8 @@ square(80, 80, 80);
480
494
  * Like the [`color`](https://q5js.org/learn/#color) function, this function
481
495
  * can accept colors in a wide range of formats: as a CSS color string,
482
496
  * a `Color` object, grayscale value, or color component values.
497
+ *
498
+ * Not available in q5 WebGPU.
483
499
  * @param {Color} color shadow color
484
500
  * @example
485
501
  createCanvas(200);
@@ -524,12 +540,14 @@ rect(104, 104, 80, 80);
524
540
  * @param {number} blur blur radius of the shadow, defaults to 0
525
541
  * @example
526
542
  createCanvas(200);
527
- background(200);
528
543
  noStroke();
529
- shadow('red');
544
+ shadow(50);
530
545
 
531
- shadowBox(-20, -8, 50);
532
- circle(100, 100, 80, 80);
546
+ function draw() {
547
+ background(200);
548
+ shadowBox(-20, mouseY, 10);
549
+ circle(100, 100, 80, 80);
550
+ }
533
551
  * @example
534
552
  createCanvas(200);
535
553
  background(200);
@@ -767,6 +785,8 @@ square(0, 0, 50);
767
785
  /** ⬜️
768
786
  * Any position coordinates or dimensions you use will be scaled based
769
787
  * on the unit provided to this function.
788
+ *
789
+ * Not available in q5 WebGPU.
770
790
  * @param {number} unit unit to scale by
771
791
  * @example
772
792
  createCanvas(200);
@@ -778,6 +798,8 @@ rect(20, 20, 60, 60);
778
798
 
779
799
  /** ⬜️
780
800
  * Creates a graphics buffer.
801
+ *
802
+ * Not available in q5 WebGPU.
781
803
  * @param {number} w width
782
804
  * @param {number} h height
783
805
  * @param {Object} [opt] options
@@ -786,7 +808,8 @@ rect(20, 20, 60, 60);
786
808
  function createGraphics(w: number, h: number, opt?: any): Q5;
787
809
 
788
810
  /** ⬜️
789
- * The 2D rendering context for the canvas.
811
+ * The 2D rendering context for the canvas, if using the Canvas2D
812
+ * renderer.
790
813
  */
791
814
  var ctx: CanvasRenderingContext2D;
792
815
 
@@ -798,14 +821,14 @@ rect(20, 20, 60, 60);
798
821
  // 💻 display
799
822
 
800
823
  /** 💻
801
- * The `displayMode` function lets you customize how your canvas is presented.
824
+ * Customize how your canvas is presented.
802
825
  * @param {string} mode
803
- * - "normal": (default) no styling to canvas or its parent element
804
- * - "centered": canvas will be centered horizontally and vertically within its parent and if the window is smaller than the canvas, the canvas will be resized to avoid clipping
805
- * - "maxed": canvas will fill the parent element, with letterboxing if necessary to preserve its aspect ratio
826
+ * - "normal": (default) canvas is not repositioned
827
+ * - "centered": canvas is moved to the center of its parent
828
+ * - "maxed": canvas will be scaled to fill the parent element, with letterboxing if necessary to preserve its aspect ratio
806
829
  * @param {string} renderQuality
807
- * - "smooth": (default) no change to the default render quality
808
- * - "pixelated": runs `pixelDensity(1)` and `noSmooth()` then sets the canvas CSS styles `image-rendering: pixelated` and `font-smooth: never`
830
+ * - "smooth": (default) smooth upscaling if the canvas is scaled
831
+ * - "pixelated": pixels rendered as sharp squares
809
832
  * @param {number} scale can also be given as a string (for example "x2")
810
833
  * @example
811
834
  createCanvas(50, 25);
@@ -830,7 +853,7 @@ createCanvas(200, 100);
830
853
  background('crimson');
831
854
  * @example
832
855
  function draw() {
833
- background(128, 20);
856
+ background(128, 100);
834
857
  circle(mouseX, mouseY, 20);
835
858
  }
836
859
  */
@@ -1109,22 +1132,36 @@ point(125, 50);
1109
1132
  // 📑 dom
1110
1133
 
1111
1134
  /** 📑
1112
- * Creates a new HTML element.
1113
- *
1114
- * q5 adds functions like `position` and `size` to the element
1115
- * that make it easy to position elements above the canvas.
1135
+ * The Document Object Model (DOM) is an interface for
1136
+ * creating and editing web pages with JavaScript.
1137
+ */
1138
+
1139
+ /** 📑
1140
+ * Creates a new HTML element and adds it to the page. `createEl` is
1141
+ * an alias.
1116
1142
  *
1117
1143
  * Modify the element's CSS [`style`](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) to change its appearance.
1118
1144
  *
1119
- * `createEl` is an alias for this function.
1145
+ * Use [`addEventListener`](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) to respond to events such as:
1146
+ * - "click": when the element is clicked
1147
+ * - "mouseover": when the mouse hovers over the element
1148
+ * - "mouseout": when the mouse stops hovering over the element
1149
+ * - "input": when a form element's value changes
1150
+ *
1151
+ * q5 adds some extra functionality to the elements it creates:
1152
+ *
1153
+ * - the `position` function makes it easy to place the element
1154
+ * relative to the canvas
1155
+ * - the `size` function sets the width and height of the element
1156
+ * - alternatively, use the element's `x`, `y`, `width`, and `height` properties
1120
1157
  * @param {string} tag tag name of the element
1121
1158
  * @param {string} [content] content of the element
1122
- * @returns {HTMLElement} created DOM element
1159
+ * @returns {HTMLElement} element
1123
1160
  * @example
1124
1161
  createCanvas(200);
1125
1162
 
1126
1163
  let el = createEl('div', '*');
1127
- el.position(0, 0);
1164
+ el.position(50, 50);
1128
1165
  el.size(100, 100);
1129
1166
  el.style.fontSize = '136px';
1130
1167
  el.style.textAlign = 'center';
@@ -1139,18 +1176,20 @@ el.style.color = 'white';
1139
1176
  * @param {string} [text] text content
1140
1177
  * @param {boolean} [newTab] whether to open the link in a new tab
1141
1178
  * @example
1142
- createCanvas(200, 100);
1179
+ createCanvas(200);
1143
1180
 
1144
1181
  let link = createA('https://q5js.org', 'q5.js');
1145
- link.position(0, 0);
1182
+ link.position(16, 42);
1146
1183
  link.style.fontSize = '80px';
1184
+
1185
+ link.addEventListener('mouseover', () => {
1186
+ background('blue');
1187
+ });
1147
1188
  */
1148
1189
  function createA(href: string, text?: string): HTMLAnchorElement;
1149
1190
 
1150
1191
  /** 📑
1151
1192
  * Creates a button element.
1152
- *
1153
- * Use [`addEventListener`](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) to respond to button click events.
1154
1193
  * @param {string} [content] text content
1155
1194
  * @example
1156
1195
  createCanvas(200, 100);
@@ -1177,7 +1216,7 @@ createCanvas(200, 100);
1177
1216
  let box = createCheckbox('Check me!');
1178
1217
  box.label.style.color = 'lime';
1179
1218
 
1180
- box.addEventListener('change', () => {
1219
+ box.addEventListener('input', () => {
1181
1220
  if (box.checked) background('lime');
1182
1221
  else background('black');
1183
1222
  });
@@ -1202,7 +1241,7 @@ function draw() {
1202
1241
  function createColorPicker(value?: string): HTMLInputElement;
1203
1242
 
1204
1243
  /** 📑
1205
- * Creates an img element.
1244
+ * Creates an image element.
1206
1245
  * @param {string} src url of the image
1207
1246
  * @example
1208
1247
  createCanvas(200, 100);
@@ -1218,6 +1257,9 @@ let img = createImg('/assets/p5play_logo.webp')
1218
1257
  *
1219
1258
  * Use the `value` property to get or set the input's value.
1220
1259
  *
1260
+ * Use the `placeholder` property to set label text that appears
1261
+ * inside the input when it's empty.
1262
+ *
1221
1263
  * See MDN's [input documentation](https://developer.mozilla.org/docs/Web/HTML/Element/input#input_types) for the full list of input types.
1222
1264
  * @param {string} [value] initial value
1223
1265
  * @param {string} [type] text input type, can be 'text', 'password', 'email', 'number', 'range', 'search', 'tel', 'url'
@@ -1280,10 +1322,12 @@ function draw() {
1280
1322
  *
1281
1323
  * Set `multiple` to `true` to allow multiple options to be selected.
1282
1324
  *
1283
- * Use the `value` property to get or set the selected option.
1325
+ * Use the `value` property to get or set the selected option value.
1284
1326
  *
1285
- * Use the `selected` property to get the selected option or options.
1286
- * @param {boolean} [placeholder] optional placeholder text that appears when no option is selected
1327
+ * Use the `selected` property get the labels of the selected
1328
+ * options or set the selected options by label. Can be a single
1329
+ * string or an array of strings.
1330
+ * @param {string} [placeholder] optional placeholder text that appears before an option is selected
1287
1331
  * @example
1288
1332
  createCanvas(200, 100);
1289
1333
 
@@ -1326,12 +1370,27 @@ function draw() {
1326
1370
  * @example
1327
1371
  createCanvas(200, 100);
1328
1372
 
1373
+ // example coming soon
1329
1374
  // let vid = createVideo('/assets/q5js_video.mp4');
1330
1375
  // vid.controls = true;
1331
1376
  // vid.loop = true;
1332
1377
  */
1333
1378
  function createVideo(src: string): HTMLVideoElement;
1334
1379
 
1380
+ /** 📑
1381
+ * Finds the first element in the DOM that matches the given [CSS selector](https://developer.mozilla.org/docs/Learn_web_development/Core/Styling_basics/Basic_selectors).
1382
+ * @param {string} selector
1383
+ * @returns {HTMLElement} element
1384
+ */
1385
+ function findElement(selector: string): HTMLElement;
1386
+
1387
+ /** 📑
1388
+ * Finds all elements in the DOM that match the given [CSS selector](https://developer.mozilla.org/docs/Learn_web_development/Core/Styling_basics/Basic_selectors).
1389
+ * @param {string} selector
1390
+ * @returns {HTMLElement[]} elements
1391
+ */
1392
+ function findElements(selector: string): HTMLElement[];
1393
+
1335
1394
  // 🌆 image
1336
1395
 
1337
1396
  /** 🌆
@@ -1679,8 +1738,8 @@ function setup() {
1679
1738
 
1680
1739
  /** 🌆
1681
1740
  * Creates a new image.
1682
- * @param {number} [w] character limit per line
1683
- * @param {number} [h] line limit
1741
+ * @param {number} w width
1742
+ * @param {number} h height
1684
1743
  * @param {any} [opt] optional settings for the image
1685
1744
  * @returns {Image}
1686
1745
  */
@@ -1710,6 +1769,7 @@ textSize(20);
1710
1769
  let info = "q5.js is a JavaScript library for creative coding. It's a sequel to p5.js that's optimized for interactive art.";
1711
1770
 
1712
1771
  text(info, 12, 30, 20, 6);
1772
+ //
1713
1773
  //
1714
1774
  */
1715
1775
  function text(str: string, x: number, y: number, wrapWidth?: number, lineLimit?: number): void;
@@ -1726,9 +1786,9 @@ text(info, 12, 30, 20, 6);
1726
1786
  *
1727
1787
  * In q5 WebGPU, fonts must be in MSDF format with the file ending
1728
1788
  * "-msdf.json". If no font is loaded before `text` is run, then
1729
- * the default font, Microsoft YaHei, is loaded:
1730
- * https://q5js.org/fonts/YaHei-msdf.json
1731
- * https://q5js.org/fonts/YaHei.png
1789
+ * the default sans serif font, Microsoft YaHei, is loaded:
1790
+ * https://q5js.org/fonts/sans-serif-msdf.json
1791
+ * https://q5js.org/fonts/sans-serif.png
1732
1792
  * @param {string} url uRL of the font to load
1733
1793
  * @param {(font: FontFace) => void} [cb] optional callback function that receives the font name as an argument once the font is loaded
1734
1794
  * @returns {FontFace} font
@@ -1991,20 +2051,22 @@ createCanvas(200);
1991
2051
  * @returns {Color} a new `Color` object
1992
2052
  * @example
1993
2053
  createCanvas(200);
1994
- // (gray, alpha)
1995
- let darkGray = color(55, 100);
1996
- background(darkGray);
1997
- // (r, g, b, a)
1998
- let blueBottle = color(0, 0, 200, 20);
1999
- fill(blueBottle);
2000
- circle(100, 50, 50);
2054
+ rect(0, 0, 100, 200);
2055
+
2056
+ // ( r, g, b, a)
2057
+ let bottle = color(90, 100, 255, 100);
2058
+ fill(bottle);
2059
+ stroke(bottle);
2060
+ strokeWeight(30);
2061
+ circle(100, 100, 155);
2001
2062
  * @example
2002
2063
  createCanvas(200);
2003
-
2004
- let c = color('gray');
2064
+ // (gray, alpha)
2065
+ let c = color(200, 50);
2005
2066
 
2006
2067
  function draw() {
2007
2068
  background(c);
2069
+ circle(mouseX, mouseY, 50);
2008
2070
  c.g = (c.g + 1) % 255;
2009
2071
  }
2010
2072
  */
@@ -2037,6 +2099,7 @@ colorMode(OKLCH);
2037
2099
 
2038
2100
  fill(0.25, 0.15, 0);
2039
2101
  rect(0, 0, 100, 200);
2102
+
2040
2103
  fill(0.75, 0.15, 0)
2041
2104
  rect(100, 0, 100, 200);
2042
2105
  */
@@ -2238,6 +2301,53 @@ noCursor();
2238
2301
 
2239
2302
  // 🧮 math
2240
2303
 
2304
+ /** 🧮
2305
+ * Generates random numbers. If no arguments are provided, returns a random number between 0 and 1.
2306
+ * If one number argument is provided, returns a random number between 0 and the provided value.
2307
+ * If two number arguments are provided, returns a random number between the two values.
2308
+ * If an array is provided, returns a random element from the array.
2309
+ * @param {number | any[]} [low] lower bound (inclusive) or an array
2310
+ * @param {number} [high] upper bound (exclusive)
2311
+ * @returns {number | any} a random number or element
2312
+ * @example
2313
+ createCanvas(200);
2314
+ background(200);
2315
+ frameRate(5);
2316
+
2317
+ function draw() {
2318
+ circle(100, 100, random(200));
2319
+ }
2320
+ */
2321
+ function random(low?: number | any[], high?: number): number | any;
2322
+
2323
+ /** 🧮
2324
+ * Generates a random number within the range of the canvas width.
2325
+ * @param {number} [margin] distance to extend (positive) or contract (negative) the range from canvas edges
2326
+ * @returns {number} random x value
2327
+ * @example
2328
+ createCanvas(200);
2329
+ background(200);
2330
+
2331
+ function draw() {
2332
+ circle(randomX(), 100, random(50));
2333
+ }
2334
+ */
2335
+ function randomX(margin?: number): number;
2336
+
2337
+ /** 🧮
2338
+ * Generates a random number within the range of the canvas height.
2339
+ * @param {number} [margin] distance to extend (positive) or contract (negative) the range from canvas edges
2340
+ * @returns {number} random y value
2341
+ * @example
2342
+ createCanvas(200);
2343
+ background(200);
2344
+
2345
+ function draw() {
2346
+ circle(100, randomY(), random(50));
2347
+ }
2348
+ */
2349
+ function randomY(margin?: number): number;
2350
+
2241
2351
  /** 🧮
2242
2352
  * Calculates the distance between two points.
2243
2353
  *
@@ -2328,17 +2438,6 @@ noCursor();
2328
2438
  */
2329
2439
  function randomSeed(seed: number): void;
2330
2440
 
2331
- /** 🧮
2332
- * Generates random numbers. If no arguments are provided, returns a random number between 0 and 1.
2333
- * If one number argument is provided, returns a random number between 0 and the provided value.
2334
- * If two number arguments are provided, returns a random number between the two values.
2335
- * If an array is provided, returns a random element from the array.
2336
- * @param {number | any[]} [a] lower bound (inclusive) or an array
2337
- * @param {number} [b] upper bound (exclusive)
2338
- * @returns {number | any} a random number or element
2339
- */
2340
- function random(a?: number | any[], b?: number): number | any;
2341
-
2342
2441
  /** 🧮
2343
2442
  * Sets the random number generation method.
2344
2443
  * @param {any} method method to use for random number generation
@@ -2361,16 +2460,13 @@ noCursor();
2361
2460
 
2362
2461
  /** 🧮
2363
2462
  * Sets the noise generation mode.
2463
+ *
2464
+ * Only the default mode, "perlin", is included in q5.js. Use of the
2465
+ * other modes requires the q5-noiser module.
2364
2466
  * @param {'perlin' | 'simplex' | 'blocky'} mode noise generation mode
2365
2467
  */
2366
2468
  function noiseMode(mode: 'perlin' | 'simplex' | 'blocky'): void;
2367
2469
 
2368
- /** 🧮
2369
- * Sets the seed value for noise generation.
2370
- * @param {number} seed seed value
2371
- */
2372
- function noiseSeed(seed: number): void;
2373
-
2374
2470
  /** 🧮
2375
2471
  * Generates a noise value based on the x, y, and z inputs.
2376
2472
  * @param {number} [x] x-coordinate input
@@ -2380,6 +2476,12 @@ noCursor();
2380
2476
  */
2381
2477
  function noise(x?: number, y?: number, z?: number): number;
2382
2478
 
2479
+ /** 🧮
2480
+ * Sets the seed value for noise generation.
2481
+ * @param {number} seed seed value
2482
+ */
2483
+ function noiseSeed(seed: number): void;
2484
+
2383
2485
  /** 🧮
2384
2486
  * Sets the level of detail for noise generation.
2385
2487
  * @param {number} lod level of detail (number of octaves)
@@ -2405,11 +2507,94 @@ noCursor();
2405
2507
  */
2406
2508
  const TAU: number;
2407
2509
 
2510
+ // 🎞️ record
2511
+
2512
+ /** 🎞️
2513
+ * q5.js has a built-in canvas recorder powered by
2514
+ * [`MediaRecorder`](https://developer.mozilla.org/docs/Web/API/MediaRecorder/MediaRecorder). It's 5-10x faster than p5.capture.
2515
+ *
2516
+ * Recording large canvases is an intensive process, so your
2517
+ * computer may not be able to do it in real time. That's okay,
2518
+ * the resulting video will playback at your sketch's target
2519
+ * frame rate.
2520
+ *
2521
+ * If real time interaction while recording is a priority,
2522
+ * consider reducing the canvas' size, frame rate, and/or
2523
+ * recording quality.
2524
+ *
2525
+ * HDR video encoding is not yet supported by any web browser.
2526
+ * For that and other advanced recording features, consider using
2527
+ * a screen capture tool like [OBS Studio](https://obsproject.com).
2528
+ */
2529
+
2530
+ /** 🎞️
2531
+ * Creates a recorder. Simply hit record to start recording!
2532
+ *
2533
+ * `format` and `quality` properties are set
2534
+ * automatically based on the height of the canvas. They can be
2535
+ * changed via the UI or programmatically.
2536
+ *
2537
+ * @returns {HTMLElement} a recorder, q5 DOM element
2538
+ * @example
2539
+ createCanvas(200);
2540
+
2541
+ createRecorder();
2542
+
2543
+ function draw() {
2544
+ circle(mouseX, random(height), 10);
2545
+ }
2546
+ */
2547
+ function createRecorder(): HTMLElement;
2548
+
2549
+ /** 🎞️
2550
+ * Starts recording the canvas or resumes recording if it was paused.
2551
+ *
2552
+ * If no recorder exists, one is created but not displayed.
2553
+ */
2554
+ function record(): void;
2555
+
2556
+ /** 🎞️
2557
+ * Pauses the canvas recording, if one is in progress.
2558
+ */
2559
+ function pauseRecording(): void;
2560
+
2561
+ /** 🎞️
2562
+ * Discards the current recording.
2563
+ */
2564
+ function deleteRecording(): void;
2565
+
2566
+ /** 🎞️
2567
+ * Saves the current recording as a video file.
2568
+ * @param {string} fileName
2569
+ * @example
2570
+ function draw() {
2571
+ square(mouseX, random(height), 10);
2572
+ }
2573
+
2574
+ function mousePressed() {
2575
+ if (!recording) record();
2576
+ else saveRecording('squares');
2577
+ }
2578
+ */
2579
+ function saveRecording(fileName): void;
2580
+
2581
+ /** 🎞️
2582
+ * True if the canvas is currently being recorded.
2583
+ */
2584
+ var recording: boolean;
2585
+
2408
2586
  // 🔊 sound
2409
2587
 
2410
2588
  /** 🔊
2411
- * Loads audio data from a file and returns a `Q5.Sound` object that
2412
- * provides low latency sound mixing powered by WebAudio.
2589
+ * q5.js includes low latency sound playback and basic mixing powered
2590
+ * by WebAudio.
2591
+ *
2592
+ * For audio filtering, synthesis, and analysis, consider using
2593
+ * [p5.sound](https://p5js.org/reference/p5.sound/).
2594
+ */
2595
+
2596
+ /** 🔊
2597
+ * Loads audio data from a file and returns a `Q5.Sound` object.
2413
2598
  *
2414
2599
  * Use functions like `play`, `pause`, and `stop` to
2415
2600
  * control playback. Note that sounds can only be played after the