q5 2.0.15 → 2.1.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
@@ -292,6 +292,18 @@ When criticized, TPF staff play the victim, silence dissent, and badmouth former
292
292
 
293
293
  In October 2023, The Processing Foundation's co-founder, Ben Fry, resigned and publicly criticized management for [squandering millions of dollars in donations](https://x.com/ben_fry/status/1709400641456501020). I agree with Ben and I hope that TPF will hire full time developers to work on p5.js in the future. The summer 2024 pro5 grants are a great step in the right direction.
294
294
 
295
+ ## Motivation: Part 3
296
+
297
+ > This section was written by @Tezumie
298
+
299
+ My journey into contributing to q5.js began with a deep passion for creative coding. I initially built my own library, T5.js, from scratch to learn more about the inner workings of a creative coding library. This project was driven by my desire to understand and enhance the process of creating visual art through code.
300
+
301
+ The q5.js team took notice of my work on T5.js and reached out to suggest we combine our efforts to further develop q5. We shared similar goals: minimizing the size of the library, optimizing performance, and adding much-needed functionalities that p5.js had yet to implement.
302
+
303
+ One of the aspects I love most about q5.js is its compatibility with p5.js add-ons, something my custom T5.js project lacked. Working with Quinton and the team has allowed me to get creative with new functionalities in q5 as well. We've collaborated on several features, such as FlexibleCanvas, which enables projects to be dimension-agnostic.
304
+
305
+ I genuinely love creative coding and engage with it every day, giving me a deep insight into the needs and potential improvements for a library like q5. My hope is to bring this knowledge and enthusiasm to our work on q5, continually advancing the library to better serve the creative coding community.
306
+
295
307
  ## More exclusive features
296
308
 
297
309
  Features added by @quinton-ashley:
@@ -302,7 +314,7 @@ Features added by @quinton-ashley:
302
314
  - `opacity(globalAlpha)`: set the opacity multiplier for anything subsequently drawn to the canvas in a range between 0 (transparent) and 1 (opaque).
303
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.
304
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.
305
- - `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.
306
318
  - `ctx`: an instance level alias for `drawingContext`
307
319
 
308
320
  Features added by @LingDong-:
@@ -313,12 +325,13 @@ Features added by @LingDong-:
313
325
 
314
326
  ## Porting from p5.js
315
327
 
316
- - `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.
317
- - `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.
318
331
  - `color` function only accepts numeric input, hex, and common named colors. It doesn't parse strings like `color('hsl(160, 100%, 50%)')`.
319
332
  - `fill`, `stroke`, and `background` can accept any CSS color string.
320
- - `colorMode` function only accepts "rgb", "srgb", or "oklch" because other formats that p5 still supports like hsv are obsolete.
321
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 using the "multiply" blend mode. To dynamically change the opacity of anything drawn to the canvas, use `opacity(globalAlpha)`.
322
335
 
323
336
  ## Size Comparison
324
337
 
@@ -373,11 +386,13 @@ Higher FPS (frames per second) is better.
373
386
 
374
387
  ## Contributing
375
388
 
389
+ Please comment on issues before attempting to implement them!
390
+
376
391
  Check out the [q5 planning board](https://github.com/orgs/q5js/projects/1/views/1).
377
392
 
378
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).
379
394
 
380
- 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).
381
396
 
382
397
  ## Licensing
383
398
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q5",
3
- "version": "2.0.15",
3
+ "version": "2.1.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,10 @@
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 && cp q5.js ../../web/p5play-web/v3/q5.js && bun min && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
17
18
  "v": "npm version patch --force",
18
19
  "V": "npm version minor --force",
19
20
  "version": "git add -A",