q5 2.0.17 → 2.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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "liveServer.settings.port": 5501
3
+ }
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # <img src="q5js_logo.webp" height="64"> <img src="q5js_brand.webp" height="64">
2
2
 
3
- The unsanctioned sequel to p5.js is here!
3
+ A sequel to p5.js that's smaller, faster, and optimized for interactive art!
4
4
 
5
5
  **q5.js** implements all of [p5][]'s 2D drawing, math, and user input functionality.
6
6
 
7
- It's a drop-in replacement that's performance optimized and ~70x smaller than p5, while packing exclusive new features: HDR color support, modular use, top-level global mode, namespace mode, and text image caching.
7
+ It's a drop-in replacement that's ~70x smaller than p5, while packing exclusive new features: HDR color support, modular use, top-level global mode, namespace mode, text image caching, dimension agnostic mode, and more.
8
8
 
9
9
  ## Typical Use
10
10
 
@@ -314,7 +314,7 @@ Features added by @quinton-ashley:
314
314
  - `opacity(globalAlpha)`: set the opacity multiplier for anything subsequently drawn to the canvas in a range between 0 (transparent) and 1 (opaque).
315
315
  - `textCache(enabled)`: Text image caching is enabled by default. Rotated text is only rendered once, and then cached as an image. This can result in ridiculously high 90x performance boosts for text-heavy sketches. Users don't need to change their code, the `text` function can be used as normal, q5 takes care of everything behind the scenes.
316
316
  - `createImage`, `loadImage`, and `createGraphics`: as a last parameter to these functions, `opt` (options) object, users can specify canvas context attributes for an image or graphic. `opt.alpha` is set to true by default.
317
- - `loadSound(file)`: Returns a Web Audio object with `setVolume()` and `setLoop()` functions added to it. Not as powerful as p5.sound, but it's good enough in some cases.
317
+ - `loadSound(file)`: Returns a Web Audio object with some basic functions added for changing the volume, setting the panning, and checking if the sound is loaded. Good enough in most cases.
318
318
  - `ctx`: an instance level alias for `drawingContext`
319
319
 
320
320
  Features added by @LingDong-:
@@ -325,12 +325,13 @@ Features added by @LingDong-:
325
325
 
326
326
  ## Porting from p5.js
327
327
 
328
- - `createCanvas` must be run before any rendering functions are called. It can be run in `preload`. If it's not run before the draw loop starts, then q5 will run `createCanvas(100, 100)` automatically.
329
- - `colorMode` supports 'rgb', 'srgb', and 'oklch'. Color modes like hsv are outdated, OKLCH is superior.
328
+ - `createCanvas` must be run before any rendering functions are called. Unlike in p5, it can be run anytime after a `Q5` instance is created, even in `preload`. If `noCanvas` isn't run before the draw loop starts, then q5 will run `createCanvas(100, 100)` automatically.
329
+ - `loadImage` and other loading functions don't support a failure callback. If the image fails to load, q5 will throw an error.
330
+ - `colorMode` supports 'rgb', 'srgb', and 'oklch'. Other color modes, like hsv, are so outdated they're obsolete.
330
331
  - `color` function only accepts numeric input, hex, and common named colors. It doesn't parse strings like `color('hsl(160, 100%, 50%)')`.
331
332
  - `fill`, `stroke`, and `background` can accept any CSS color string.
332
- - `colorMode` function only accepts "rgb", "srgb", or "oklch" because other formats that p5 still supports like hsv are obsolete.
333
333
  - `noise` function's default noise algorithm is perlin noise. p5's default noise is called "blocky" noise in q5 and using it requires loading the src/q5-noisier.js module.
334
+ - `tint` doesn't change the opacity of an image, instead the tint's alpha value specifies how strong the tint should be. To dynamically change the opacity of anything drawn to the canvas, use `opacity(globalAlpha)`.
334
335
 
335
336
  ## Size Comparison
336
337
 
@@ -385,11 +386,13 @@ Higher FPS (frames per second) is better.
385
386
 
386
387
  ## Contributing
387
388
 
389
+ Please comment on issues before attempting to implement them!
390
+
388
391
  Check out the [q5 planning board](https://github.com/orgs/q5js/projects/1/views/1).
389
392
 
390
393
  If the q5 project is successful, all contributing developers will be paid for their work. The project will be run as a [worker co-op](https://en.wikipedia.org/wiki/Worker_cooperative).
391
394
 
392
- Contributors must agree to the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
395
+ Contributors must agree to the [code of conduct](CODE_OF_CONDUCT.md) and follow the [q5 code style guide](https://github.com/q5js/q5.js/wiki/q5-Code-Style-Guide).
393
396
 
394
397
  ## Licensing
395
398
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q5",
3
- "version": "2.0.17",
3
+ "version": "2.2.0",
4
4
  "description": "A sequel to p5.js that's smaller and faster",
5
5
  "author": "quinton-ashley",
6
6
  "contributors": [
@@ -11,9 +11,11 @@
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-2d-canvas.js src/q5-2d-drawing.js src/q5-2d-image.js src/q5-2d-soft-filters.js src/q5-2d-text.js src/q5-ai.js src/q5-color.js src/q5-display.js src/q5-input.js src/q5-math.js src/q5-sound.js src/q5-util.js src/q5-vector.js > q5.js",
15
- "min": "terser q5.js --compress ecma=2024 --mangle > q5.min.js",
16
- "dist": "bun bundle && cp q5.js ../../web/p5play-web/v3/q5.js && bun min && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
14
+ "bundle": "cat src/q5-core.js src/q5-canvas.js src/q5-2d-canvas.js src/q5-2d-drawing.js src/q5-2d-image.js src/q5-2d-soft-filters.js src/q5-2d-text.js src/q5-ai.js src/q5-color.js src/q5-display.js src/q5-input.js src/q5-math.js src/q5-sound.js src/q5-util.js src/q5-vector.js > q5.js",
15
+ "bundle-webgpu": "cat src/q5-core.js src/q5-canvas.js src/q5-2d-canvas.js src/q5-2d-drawing.js src/q5-2d-image.js src/q5-2d-text.js src/q5-ai.js src/q5-color.js src/q5-display.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-webgpu.js",
16
+ "min": "terser q5.js --compress ecma=2024 --mangle > q5.min.js && terser q5-webgpu.js --compress ecma=2024 --mangle > q5-webgpu.min.js",
17
+ "dist": "bun bundle && bun bundle-webgpu",
18
+ "dist-p5play": "bun dist && cp q5.js ../../web/p5play-web/v3/q5.js && bun min && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
17
19
  "v": "npm version patch --force",
18
20
  "V": "npm version minor --force",
19
21
  "version": "git add -A",