p5 2.2.1-rc.0 → 2.2.1

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 (117) hide show
  1. package/dist/accessibility/color_namer.js +5 -6
  2. package/dist/accessibility/describe.js +4 -26
  3. package/dist/accessibility/index.js +5 -6
  4. package/dist/accessibility/outputs.js +6 -38
  5. package/dist/app.js +5 -6
  6. package/dist/color/color_conversion.js +5 -6
  7. package/dist/color/creating_reading.js +1 -1
  8. package/dist/color/index.js +2 -2
  9. package/dist/color/p5.Color.js +1 -1
  10. package/dist/color/setting.js +59 -357
  11. package/dist/{constants-DEJVKr9Z.js → constants-DQyACdzq.js} +11 -61
  12. package/dist/core/constants.js +1 -1
  13. package/dist/core/environment.js +26 -158
  14. package/dist/core/filterShaders.js +1 -1
  15. package/dist/core/friendly_errors/fes_core.js +1 -1
  16. package/dist/core/friendly_errors/file_errors.js +1 -1
  17. package/dist/core/friendly_errors/index.js +1 -1
  18. package/dist/core/friendly_errors/param_validator.js +1 -1
  19. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  20. package/dist/core/helpers.js +1 -1
  21. package/dist/core/init.js +5 -6
  22. package/dist/core/internationalization.js +1 -1
  23. package/dist/core/legacy.js +5 -6
  24. package/dist/core/main.js +5 -6
  25. package/dist/core/p5.Graphics.js +4 -5
  26. package/dist/core/p5.Renderer.js +3 -4
  27. package/dist/core/p5.Renderer2D.js +5 -6
  28. package/dist/core/p5.Renderer3D.js +4 -5
  29. package/dist/core/rendering.js +4 -5
  30. package/dist/core/structure.js +13 -52
  31. package/dist/core/transform.js +32 -176
  32. package/dist/{creating_reading-CgHCHxqN.js → creating_reading-ZXzcZEsb.js} +3 -196
  33. package/dist/data/local_storage.js +4 -30
  34. package/dist/dom/dom.js +24 -159
  35. package/dist/dom/index.js +2 -2
  36. package/dist/dom/p5.Element.js +31 -208
  37. package/dist/dom/p5.File.js +1 -32
  38. package/dist/dom/p5.MediaElement.js +10 -113
  39. package/dist/events/acceleration.js +11 -64
  40. package/dist/events/keyboard.js +13 -81
  41. package/dist/events/pointer.js +18 -160
  42. package/dist/image/const.js +1 -1
  43. package/dist/image/filterRenderer2D.js +4 -5
  44. package/dist/image/image.js +4 -5
  45. package/dist/image/index.js +4 -5
  46. package/dist/image/loading_displaying.js +4 -5
  47. package/dist/image/p5.Image.js +3 -4
  48. package/dist/image/pixels.js +17 -100
  49. package/dist/io/files.js +4 -5
  50. package/dist/io/index.js +4 -5
  51. package/dist/io/p5.Table.js +66 -158
  52. package/dist/io/p5.TableRow.js +48 -71
  53. package/dist/io/p5.XML.js +6 -99
  54. package/dist/io/utilities.js +8 -3
  55. package/dist/{main-_RXV5Lx8.js → main-DvN69W3f.js} +13 -42
  56. package/dist/math/Matrices/Matrix.js +87 -126
  57. package/dist/math/Matrices/MatrixNumjs.js +1 -5
  58. package/dist/math/calculation.js +10 -112
  59. package/dist/math/index.js +1 -1
  60. package/dist/math/math.js +2 -12
  61. package/dist/math/noise.js +5 -32
  62. package/dist/math/p5.Matrix.js +3 -3
  63. package/dist/math/p5.Vector.js +104 -345
  64. package/dist/math/random.js +5 -32
  65. package/dist/math/trigonometry.js +15 -105
  66. package/dist/{p5.Renderer-QoFcvj3f.js → p5.Renderer-D-5LdCRz.js} +25 -178
  67. package/dist/{rendering-CsICjEXA.js → rendering-h9unX5K0.js} +254 -1156
  68. package/dist/shape/2d_primitives.js +33 -194
  69. package/dist/shape/attributes.js +12 -73
  70. package/dist/shape/curves.js +30 -95
  71. package/dist/shape/custom_shapes.js +63 -144
  72. package/dist/shape/index.js +2 -2
  73. package/dist/shape/vertex.js +21 -106
  74. package/dist/strands/p5.strands.js +248 -46
  75. package/dist/type/index.js +3 -4
  76. package/dist/type/p5.Font.js +4 -49
  77. package/dist/type/textCore.js +5 -158
  78. package/dist/utilities/conversion.js +17 -104
  79. package/dist/utilities/time_date.js +3 -40
  80. package/dist/utilities/utility_functions.js +6 -48
  81. package/dist/webgl/3d_primitives.js +4 -5
  82. package/dist/webgl/GeometryBuilder.js +1 -2
  83. package/dist/webgl/ShapeBuilder.js +22 -2
  84. package/dist/webgl/enums.js +1 -1
  85. package/dist/webgl/index.js +4 -5
  86. package/dist/webgl/interaction.js +6 -33
  87. package/dist/webgl/light.js +4 -5
  88. package/dist/webgl/loading.js +12 -46
  89. package/dist/webgl/material.js +4 -5
  90. package/dist/webgl/p5.Camera.js +4 -5
  91. package/dist/webgl/p5.DataArray.js +0 -4
  92. package/dist/webgl/p5.Framebuffer.js +4 -5
  93. package/dist/webgl/p5.Geometry.js +12 -106
  94. package/dist/webgl/p5.Quat.js +1 -1
  95. package/dist/webgl/p5.RendererGL.js +7 -18
  96. package/dist/webgl/p5.Shader.js +12 -36
  97. package/dist/webgl/p5.Texture.js +4 -5
  98. package/dist/webgl/text.js +4 -5
  99. package/dist/webgl/utils.js +4 -5
  100. package/dist/webgpu/index.js +1 -1
  101. package/dist/webgpu/p5.RendererWebGPU.js +529 -208
  102. package/dist/webgpu/shaders/color.js +32 -17
  103. package/dist/webgpu/shaders/filters/base.js +18 -7
  104. package/dist/webgpu/shaders/font.js +52 -40
  105. package/dist/webgpu/shaders/line.js +50 -36
  106. package/dist/webgpu/shaders/material.js +90 -83
  107. package/dist/webgpu/strands_wgslBackend.js +5 -2
  108. package/lib/p5.esm.js +5576 -7811
  109. package/lib/p5.esm.min.js +1 -1
  110. package/lib/p5.js +5576 -7811
  111. package/lib/p5.min.js +1 -1
  112. package/lib/p5.webgpu.esm.js +786 -453
  113. package/lib/p5.webgpu.js +786 -453
  114. package/lib/p5.webgpu.min.js +1 -1
  115. package/package.json +13 -13
  116. package/types/global.d.ts +16905 -16783
  117. package/types/p5.d.ts +11142 -11081
@@ -1,12 +1,12 @@
1
- import { P as P2D, ac as WEBGL, B as BLEND, al as _DEFAULT_FILL, am as _DEFAULT_STROKE, w as ROUND, b as REMOVE, S as SUBTRACT, D as DARKEST, L as LIGHTEST, an as DIFFERENCE, M as MULTIPLY, E as EXCLUSION, a as SCREEN, R as REPLACE, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, as as BURN, A as ADD, at as PIE, au as CHORD, q as TWO_PI, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER, a9 as RIGHT, v as CENTER, av as LEFT, aw as BOTTOM, ax as BASELINE, ay as TOP, Q as OPEN, az as VERSION, a3 as constants } from './constants-DEJVKr9Z.js';
1
+ import { P as P2D, ac as WEBGL, B as BLEND, al as _DEFAULT_FILL, am as _DEFAULT_STROKE, w as ROUND, b as REMOVE, S as SUBTRACT, D as DARKEST, L as LIGHTEST, an as DIFFERENCE, M as MULTIPLY, E as EXCLUSION, a as SCREEN, R as REPLACE, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, as as BURN, A as ADD, at as PIE, au as CHORD, q as TWO_PI, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER, a9 as RIGHT, v as CENTER, av as LEFT, aw as BOTTOM, ax as BASELINE, ay as TOP, Q as OPEN, az as VERSION, a3 as constants } from './constants-DQyACdzq.js';
2
2
  import transform from './core/transform.js';
3
3
  import structure from './core/structure.js';
4
4
  import environment from './core/environment.js';
5
- import { G as Graphics, k as rendering, n as graphics } from './rendering-CsICjEXA.js';
6
- import { R as Renderer, I as Image, r as renderer } from './p5.Renderer-QoFcvj3f.js';
5
+ import { G as Graphics, k as rendering, n as graphics } from './rendering-h9unX5K0.js';
6
+ import { R as Renderer, I as Image, r as renderer } from './p5.Renderer-D-5LdCRz.js';
7
7
  import { Element } from './dom/p5.Element.js';
8
8
  import { MediaElement } from './dom/p5.MediaElement.js';
9
- import { b as RGBHDR } from './creating_reading-CgHCHxqN.js';
9
+ import { b as RGBHDR } from './creating_reading-ZXzcZEsb.js';
10
10
  import FilterRenderer2D from './image/filterRenderer2D.js';
11
11
  import './math/p5.Matrix.js';
12
12
  import { PrimitiveToPath2DConverter } from './shape/custom_shapes.js';
@@ -273,7 +273,10 @@ class Renderer2D extends Renderer {
273
273
  });
274
274
  shape.accept(visitor);
275
275
  if (this._clipping) {
276
- this.clipPath.addPath(visitor.path);
276
+ const currentTransform = this.drawingContext.getTransform();
277
+ const clipBaseTransform = this._clipBaseTransform.inverse();
278
+ const relativeTransform = clipBaseTransform.multiply(currentTransform);
279
+ this.clipPath.addPath(visitor.path, relativeTransform);
277
280
  this.clipPath.closePath();
278
281
  } else {
279
282
  if (this.states.fillColor) {
@@ -287,7 +290,7 @@ class Renderer2D extends Renderer {
287
290
 
288
291
  beginClip(options = {}) {
289
292
  super.beginClip(options);
290
-
293
+ this._clipBaseTransform = this.drawingContext.getTransform();
291
294
  // cache the fill style
292
295
  this.states.setValue('_cachedFillStyle', this.drawingContext.fillStyle);
293
296
  const newFill = this._pInst.color(255, 0).toString();
@@ -1596,8 +1599,6 @@ class p5 {
1596
1599
  * `new p5()`.
1597
1600
  *
1598
1601
  * @example
1599
- * <div>
1600
- * <code>
1601
1602
  * // Double-click to remove the canvas.
1602
1603
  *
1603
1604
  * function setup() {
@@ -1620,8 +1621,6 @@ class p5 {
1620
1621
  * function doubleClicked() {
1621
1622
  * remove();
1622
1623
  * }
1623
- * </code>
1624
- * </div>
1625
1624
  */
1626
1625
  async remove() {
1627
1626
  // Remove start listener to prevent orphan canvas being created
@@ -1830,8 +1829,6 @@ p5.registerAddon(graphics);
1830
1829
  * @for p5
1831
1830
  *
1832
1831
  * @example
1833
- * <div>
1834
- * <code>
1835
1832
  * function setup() {
1836
1833
  * createCanvas(100, 100);
1837
1834
  *
@@ -1842,11 +1839,8 @@ p5.registerAddon(graphics);
1842
1839
  *
1843
1840
  * describe('A white circle on a gray background.');
1844
1841
  * }
1845
- * </code>
1846
- * </div>
1847
1842
  *
1848
- * <div>
1849
- * <code>
1843
+ * @example
1850
1844
  * function setup() {
1851
1845
  * createCanvas(100, 100);
1852
1846
  *
@@ -1862,11 +1856,8 @@ p5.registerAddon(graphics);
1862
1856
  * // Draw circles repeatedly.
1863
1857
  * circle(mouseX, mouseY, 40);
1864
1858
  * }
1865
- * </code>
1866
- * </div>
1867
1859
  *
1868
- * <div>
1869
- * <code>
1860
+ * @example
1870
1861
  * let img;
1871
1862
  *
1872
1863
  * async function setup() {
@@ -1889,8 +1880,6 @@ p5.registerAddon(graphics);
1889
1880
  * // Draw the circle.
1890
1881
  * circle(mouseX, mouseY, 10);
1891
1882
  * }
1892
- * </code>
1893
- * </div>
1894
1883
  */
1895
1884
  /**
1896
1885
  * A function that's called repeatedly while the sketch runs.
@@ -1923,8 +1912,6 @@ p5.registerAddon(graphics);
1923
1912
  * @for p5
1924
1913
  *
1925
1914
  * @example
1926
- * <div>
1927
- * <code>
1928
1915
  * function setup() {
1929
1916
  * createCanvas(100, 100);
1930
1917
  *
@@ -1940,11 +1927,8 @@ p5.registerAddon(graphics);
1940
1927
  * // Draw circles repeatedly.
1941
1928
  * circle(mouseX, mouseY, 40);
1942
1929
  * }
1943
- * </code>
1944
- * </div>
1945
1930
  *
1946
- * <div>
1947
- * <code>
1931
+ * @example
1948
1932
  * function setup() {
1949
1933
  * createCanvas(100, 100);
1950
1934
  *
@@ -1960,11 +1944,8 @@ p5.registerAddon(graphics);
1960
1944
  * // Draw circles repeatedly.
1961
1945
  * circle(mouseX, mouseY, 40);
1962
1946
  * }
1963
- * </code>
1964
- * </div>
1965
1947
  *
1966
- * <div>
1967
- * <code>
1948
+ * @example
1968
1949
  * // Double-click the canvas to change the circle's color.
1969
1950
  *
1970
1951
  * function setup() {
@@ -1987,8 +1968,6 @@ p5.registerAddon(graphics);
1987
1968
  * function doubleClicked() {
1988
1969
  * fill('deeppink');
1989
1970
  * }
1990
- * </code>
1991
- * </div>
1992
1971
  */
1993
1972
 
1994
1973
  /**
@@ -2004,8 +1983,6 @@ p5.registerAddon(graphics);
2004
1983
  * @property {Boolean} disableFriendlyErrors
2005
1984
  *
2006
1985
  * @example
2007
- * <div>
2008
- * <code>
2009
1986
  * // Disable the FES.
2010
1987
  * p5.disableFriendlyErrors = true;
2011
1988
  *
@@ -2022,8 +1999,6 @@ p5.registerAddon(graphics);
2022
1999
  *
2023
2000
  * describe('A gray square.');
2024
2001
  * }
2025
- * </code>
2026
- * </div>
2027
2002
  */
2028
2003
 
2029
2004
  /**
@@ -2040,8 +2015,6 @@ p5.registerAddon(graphics);
2040
2015
  * @param {Function} library The library function to register
2041
2016
  *
2042
2017
  * @example
2043
- * <div>
2044
- * <code>
2045
2018
  * function myAddon(p5, fn, lifecycles) {
2046
2019
  * fn.sayHello = function() {
2047
2020
  * this.textAlign(this.CENTER, this.CENTER);
@@ -2058,8 +2031,6 @@ p5.registerAddon(graphics);
2058
2031
  *
2059
2032
  * describe('The text "Hello!"');
2060
2033
  * }
2061
- * </code>
2062
- * </div>
2063
2034
  */
2064
2035
 
2065
2036
  export { Renderer2D as R, p5 as p, renderer2D as r };