q5 1.0.22 → 1.0.25
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 +10 -6
- package/package.json +1 -1
- package/q5.js +4 -2
package/README.md
CHANGED
|
@@ -10,13 +10,21 @@ q5 doesn't include any friendly error messages to help you code though. Its main
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
+
q5 should work with your existing p5.js sketches, no modifications required! If you have any problems though, please [make an issue report.][]
|
|
14
|
+
|
|
15
|
+
Try out the [q5.js template sketch](https://editor.p5js.org/quinton-ashley/sketches/8SEtLEDl9) for the online p5.js Web Editor.
|
|
16
|
+
|
|
17
|
+
Or you can use q5.js in your own project by adding this line to your HTML file:
|
|
18
|
+
|
|
13
19
|
```html
|
|
14
20
|
<script src="https://quinton-ashley.github.io/q5.js/q5.js"></script>
|
|
15
21
|
```
|
|
16
22
|
|
|
17
|
-
q5
|
|
23
|
+
q5 is also available on [npm](https://www.npmjs.com/package/q5)!
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
```bash
|
|
26
|
+
npm install q5
|
|
27
|
+
```
|
|
20
28
|
|
|
21
29
|
## Using p5 Addons
|
|
22
30
|
|
|
@@ -51,10 +59,6 @@ Co-creator of q5, @quinton-ashley, added a ton of features:
|
|
|
51
59
|
- fixed `Vector.lerp` implementation
|
|
52
60
|
- fixed `mouseX` and `mouseY` not updating when the mouse is outside the canvas
|
|
53
61
|
|
|
54
|
-
Known issues:
|
|
55
|
-
|
|
56
|
-
- When the first frame in a sketch is drawn to the canvas, it's as if the origin of the canvas has been translated to the middle. I tried using `canvas.translate(0, 0)` in `createCanvas` but it didn't help. This can be tested using `noLoop()` in setup.
|
|
57
|
-
|
|
58
62
|
## Motivation: Part 1
|
|
59
63
|
|
|
60
64
|
_This section was written by @LingDong-, co-creator of q5_
|
package/package.json
CHANGED
package/q5.js
CHANGED
|
@@ -802,7 +802,8 @@ function Q5(scope, parent) {
|
|
|
802
802
|
}
|
|
803
803
|
|
|
804
804
|
$.strokeWeight = (n) => {
|
|
805
|
-
$._doStroke = true;
|
|
805
|
+
if (n > 0) $._doStroke = true;
|
|
806
|
+
else $._doStroke = false;
|
|
806
807
|
ctx.lineWidth = n;
|
|
807
808
|
};
|
|
808
809
|
$.stroke = function () {
|
|
@@ -1679,6 +1680,7 @@ function Q5(scope, parent) {
|
|
|
1679
1680
|
};
|
|
1680
1681
|
|
|
1681
1682
|
$.remove = () => {
|
|
1683
|
+
$.noLoop();
|
|
1682
1684
|
$.canvas.remove();
|
|
1683
1685
|
};
|
|
1684
1686
|
|
|
@@ -2596,7 +2598,7 @@ Q5.prototype.registerMethod = function () {
|
|
|
2596
2598
|
};
|
|
2597
2599
|
Q5.prototype.registerPreloadMethod = () => {};
|
|
2598
2600
|
Q5._validateParameters = () => true;
|
|
2599
|
-
window.p5
|
|
2601
|
+
window.p5 ??= Q5;
|
|
2600
2602
|
|
|
2601
2603
|
document.addEventListener('DOMContentLoaded', () => {
|
|
2602
2604
|
if (!Q5._hasGlobal) new Q5('auto');
|