q5 2.9.21 → 2.9.23

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.
Files changed (77) hide show
  1. package/.vscode/launch.json +26 -0
  2. package/bun.lockb +0 -0
  3. package/p5-tests/js/chai_helpers.js +20 -0
  4. package/p5-tests/js/mocha_setup.js +2 -0
  5. package/p5-tests/js/modernizr.js +5 -0
  6. package/p5-tests/js/p5_helpers.js +135 -0
  7. package/p5-tests/js/sinon.js +5949 -0
  8. package/p5-tests/mocha.css +289 -0
  9. package/p5-tests/test.html +71 -0
  10. package/p5-tests/unit/color/color_conversion.js +68 -0
  11. package/p5-tests/unit/color/creating_reading.js +217 -0
  12. package/p5-tests/unit/color/p5.Color.js +1000 -0
  13. package/p5-tests/unit/color/setting.js +289 -0
  14. package/p5-tests/unit/core/2d_primitives.js +490 -0
  15. package/p5-tests/unit/core/attributes.js +115 -0
  16. package/p5-tests/unit/core/curves.js +139 -0
  17. package/p5-tests/unit/core/environment.js +248 -0
  18. package/p5-tests/unit/core/error_helpers.js +1158 -0
  19. package/p5-tests/unit/core/main.js +340 -0
  20. package/p5-tests/unit/core/p5.Element.js +773 -0
  21. package/p5-tests/unit/core/p5.Graphics.js +179 -0
  22. package/p5-tests/unit/core/preload.js +285 -0
  23. package/p5-tests/unit/core/rendering.js +116 -0
  24. package/p5-tests/unit/core/structure.js +293 -0
  25. package/p5-tests/unit/core/transform.js +144 -0
  26. package/p5-tests/unit/core/version.js +28 -0
  27. package/p5-tests/unit/core/vertex.js +137 -0
  28. package/p5-tests/unit/dom/dom.js +2146 -0
  29. package/p5-tests/unit/events/acceleration.js +213 -0
  30. package/p5-tests/unit/events/keyboard.js +179 -0
  31. package/p5-tests/unit/events/mouse.js +487 -0
  32. package/p5-tests/unit/events/touch.js +180 -0
  33. package/p5-tests/unit/image/downloading.js +379 -0
  34. package/p5-tests/unit/image/filters.js +92 -0
  35. package/p5-tests/unit/image/loading.js +413 -0
  36. package/p5-tests/unit/image/p5.Image.js +201 -0
  37. package/p5-tests/unit/image/pixels.js +234 -0
  38. package/p5-tests/unit/io/files.js +378 -0
  39. package/p5-tests/unit/io/loadBytes.js +149 -0
  40. package/p5-tests/unit/io/loadImage.js +123 -0
  41. package/p5-tests/unit/io/loadJSON.js +185 -0
  42. package/p5-tests/unit/io/loadModel.js +215 -0
  43. package/p5-tests/unit/io/loadShader.js +176 -0
  44. package/p5-tests/unit/io/loadStrings.js +140 -0
  45. package/p5-tests/unit/io/loadTable.js +183 -0
  46. package/p5-tests/unit/io/loadXML.js +127 -0
  47. package/p5-tests/unit/io/saveModel.js +113 -0
  48. package/p5-tests/unit/io/saveTable.js +142 -0
  49. package/p5-tests/unit/math/calculation.js +452 -0
  50. package/p5-tests/unit/math/noise.js +66 -0
  51. package/p5-tests/unit/math/p5.Vector.js +1886 -0
  52. package/p5-tests/unit/math/random.js +177 -0
  53. package/p5-tests/unit/math/trigonometry.js +144 -0
  54. package/p5-tests/unit/spec.js +50 -0
  55. package/p5-tests/unit/typography/attributes.js +120 -0
  56. package/p5-tests/unit/typography/loadFont.js +162 -0
  57. package/p5-tests/unit/typography/p5.Font.js +63 -0
  58. package/p5-tests/unit/utilities/conversion.js +329 -0
  59. package/p5-tests/unit/utilities/time_date.js +133 -0
  60. package/package.json +1 -1
  61. package/q5.js +158 -54
  62. package/q5.min.js +1 -1
  63. package/src/q5-2d-canvas.js +8 -2
  64. package/src/q5-2d-drawing.js +20 -7
  65. package/src/q5-2d-image.js +4 -1
  66. package/src/q5-2d-text.js +7 -0
  67. package/src/q5-canvas.js +6 -5
  68. package/src/q5-color.js +5 -0
  69. package/src/q5-core.js +3 -1
  70. package/src/q5-input.js +12 -0
  71. package/src/q5-math.js +11 -3
  72. package/src/q5-record.js +2 -0
  73. package/src/q5-vector.js +33 -0
  74. package/src/q5-webgpu-canvas.js +11 -7
  75. package/src/q5-webgpu-drawing.js +15 -12
  76. package/src/q5-webgpu-image.js +1 -1
  77. package/src/q5-webgpu-text.js +22 -15
@@ -0,0 +1,66 @@
1
+ suite('Noise', function() {
2
+ var myp5;
3
+
4
+ setup(function(done) {
5
+ new p5(function(p) {
6
+ p.setup = function() {
7
+ myp5 = p;
8
+ done();
9
+ };
10
+ });
11
+ });
12
+
13
+ teardown(function() {
14
+ myp5.remove();
15
+ });
16
+
17
+ // This could use some better testing!
18
+ // Just checking that we get an actual number now
19
+ // 1D noise only
20
+ // ALso need test for noiseSeed and noiseDetail
21
+ var result;
22
+ var results = [];
23
+
24
+ suite('p5.prototype.noise', function() {
25
+ setup(function() {
26
+ result = myp5.noise(0);
27
+ });
28
+ test('should return a number', function() {
29
+ assert.typeOf(result, 'number');
30
+ });
31
+ test('should return a number 0 < n < 1', function() {
32
+ assert.isTrue(result > 0);
33
+ assert.isTrue(result < 1);
34
+ });
35
+ });
36
+
37
+ // Test for noiseSeed
38
+ suite('p5.prototype.noiseSeed', function() {
39
+ setup(function() {
40
+ myp5.noiseSeed(99);
41
+ var t = 0;
42
+ for (var i = 0; i < 5; i++) {
43
+ results[i] = myp5.noise(t);
44
+ t += 0.01;
45
+ }
46
+ myp5.noiseSeed(99);
47
+ t = 0;
48
+ for (i = 5; i < 10; i++) {
49
+ results[i] = myp5.noise(t);
50
+ t += 0.01;
51
+ }
52
+ });
53
+ test('should return a number 0 < n < 1', function() {
54
+ for (var i = 0; i < results.length; i++) {
55
+ assert.typeOf(results[i], 'number');
56
+ assert.isTrue(results[i] > 0);
57
+ assert.isTrue(results[i] < 1);
58
+ }
59
+ });
60
+ test('should return same sequence of numbers', function() {
61
+ for (var i = 0; i < 5; i++) {
62
+ assert.isTrue(results[i] === results[i + 5]);
63
+ }
64
+ });
65
+ });
66
+ });