p5 2.0.0 → 2.0.2

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 (267) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +12 -2
  3. package/{src → dist}/accessibility/gridOutput.js +2 -2
  4. package/dist/accessibility/index.js +60 -0
  5. package/{src → dist}/accessibility/outputs.js +23 -2
  6. package/{src → dist}/accessibility/textOutput.js +2 -2
  7. package/dist/app.js +120 -0
  8. package/{src → dist}/color/color_conversion.js +48 -10
  9. package/{src → dist}/color/color_spaces/hsb.js +3 -1
  10. package/dist/color/creating_reading.js +3 -0
  11. package/dist/color/index.js +13 -0
  12. package/dist/color/p5.Color.culori.js +1 -0
  13. package/dist/color/p5.Color.js +3 -0
  14. package/{src → dist}/color/setting.js +9 -6
  15. package/{src/core/constants.js → dist/constants-tYr0tCl8.js} +284 -132
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +12 -10
  19. package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
  20. package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
  21. package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
  22. package/dist/core/friendly_errors/index.js +23 -0
  23. package/dist/core/friendly_errors/param_validator.js +5421 -0
  24. package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
  25. package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
  26. package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
  27. package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
  28. package/{src → dist}/core/helpers.js +9 -6
  29. package/dist/core/init.js +105 -0
  30. package/dist/core/internationalization.js +302 -0
  31. package/dist/core/legacy.js +73 -0
  32. package/dist/core/main.js +44 -0
  33. package/dist/core/noop.js +3 -0
  34. package/dist/core/p5.Graphics.js +40 -0
  35. package/dist/core/p5.Renderer.js +11 -0
  36. package/dist/core/p5.Renderer2D.js +44 -0
  37. package/dist/core/reference.js +1 -0
  38. package/dist/core/rendering.js +40 -0
  39. package/{src → dist}/core/structure.js +3 -3
  40. package/{src → dist}/core/transform.js +2 -2
  41. package/{src/color/creating_reading.js → dist/creating_reading-Cr8L2Jnm.js} +841 -13
  42. package/{src → dist}/data/index.js +3 -1
  43. package/{src → dist}/data/local_storage.js +2 -8
  44. package/{src → dist}/dom/dom.js +19 -13
  45. package/dist/dom/index.js +18 -0
  46. package/{src → dist}/dom/p5.Element.js +14 -12
  47. package/{src → dist}/dom/p5.File.js +4 -4
  48. package/{src → dist}/dom/p5.MediaElement.js +10 -4
  49. package/{src → dist}/events/acceleration.js +26 -26
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -12
  52. package/{src → dist}/events/pointer.js +16 -17
  53. package/dist/image/const.js +9 -0
  54. package/{src → dist}/image/filterRenderer2D.js +57 -37
  55. package/{src → dist}/image/filters.js +1 -3
  56. package/dist/image/image.js +40 -0
  57. package/dist/image/index.js +51 -0
  58. package/dist/image/loading_displaying.js +40 -0
  59. package/dist/image/p5.Image.js +11 -0
  60. package/{src → dist}/image/pixels.js +5 -3
  61. package/{src → dist}/io/csv.js +72 -70
  62. package/dist/io/files.js +40 -0
  63. package/dist/io/index.js +51 -0
  64. package/{src → dist}/io/p5.Table.js +6 -6
  65. package/{src → dist}/io/p5.TableRow.js +5 -6
  66. package/{src → dist}/io/p5.XML.js +2 -5
  67. package/{src → dist}/io/utilities.js +1 -1
  68. package/{src/core/p5.Renderer2D.js → dist/main-CAxvgiOV.js} +738 -57
  69. package/{src → dist}/math/Matrices/Matrix.js +10 -8
  70. package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
  71. package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
  72. package/{src → dist}/math/calculation.js +2 -2
  73. package/{src → dist}/math/index.js +6 -3
  74. package/{src → dist}/math/math.js +3 -3
  75. package/{src → dist}/math/noise.js +2 -2
  76. package/{src → dist}/math/p5.Matrix.js +7 -4
  77. package/{src → dist}/math/p5.Vector.js +6 -6
  78. package/{src → dist}/math/random.js +2 -2
  79. package/{src → dist}/math/trigonometry.js +16 -15
  80. package/{src/image/p5.Image.js → dist/p5.Renderer-Swjl9HQO.js} +393 -22
  81. package/dist/rendering-B5TRR7aY.js +24960 -0
  82. package/{src → dist}/shape/2d_primitives.js +18 -17
  83. package/{src → dist}/shape/attributes.js +18 -17
  84. package/{src → dist}/shape/curves.js +2 -2
  85. package/{src → dist}/shape/custom_shapes.js +44 -64
  86. package/{src → dist}/shape/index.js +10 -2
  87. package/{src → dist}/shape/vertex.js +2 -3
  88. package/dist/type/index.js +25 -0
  89. package/{src → dist}/type/lib/Typr.js +76 -94
  90. package/{src → dist}/type/p5.Font.js +37 -63
  91. package/{src → dist}/type/textCore.js +35 -58
  92. package/{src → dist}/type/unicodeRanges.js +3 -1
  93. package/{src → dist}/utilities/conversion.js +2 -2
  94. package/{src → dist}/utilities/index.js +3 -1
  95. package/{src → dist}/utilities/time_date.js +6 -7
  96. package/{src → dist}/utilities/utility_functions.js +2 -2
  97. package/dist/webgl/3d_primitives.js +40 -0
  98. package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
  99. package/{src → dist}/webgl/GeometryBuilder.js +12 -8
  100. package/{src → dist}/webgl/ShaderGenerator.js +79 -82
  101. package/{src → dist}/webgl/ShapeBuilder.js +26 -23
  102. package/dist/webgl/index.js +76 -0
  103. package/{src → dist}/webgl/interaction.js +7 -6
  104. package/dist/webgl/light.js +40 -0
  105. package/{src → dist}/webgl/loading.js +45 -12
  106. package/dist/webgl/material.js +40 -0
  107. package/dist/webgl/p5.Camera.js +40 -0
  108. package/{src → dist}/webgl/p5.DataArray.js +3 -5
  109. package/dist/webgl/p5.Framebuffer.js +40 -0
  110. package/{src → dist}/webgl/p5.Geometry.js +12 -15
  111. package/{src → dist}/webgl/p5.Quat.js +5 -4
  112. package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
  113. package/dist/webgl/p5.RendererGL.js +40 -0
  114. package/dist/webgl/p5.Shader.js +40 -0
  115. package/dist/webgl/p5.Texture.js +40 -0
  116. package/{src → dist}/webgl/text.js +78 -38
  117. package/lib/p5.esm.js +296 -194
  118. package/lib/p5.js +296 -194
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -17
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/types/accessibility/color_namer.d.ts +8 -0
  124. package/types/accessibility/describe.d.ts +184 -0
  125. package/types/accessibility/gridOutput.d.ts +8 -0
  126. package/types/accessibility/outputs.d.ts +235 -0
  127. package/types/accessibility/textOutput.d.ts +8 -0
  128. package/types/color/color_conversion.d.ts +47 -0
  129. package/types/color/creating_reading.d.ts +1348 -0
  130. package/types/color/p5.Color.d.ts +1070 -0
  131. package/types/color/setting.d.ts +2085 -0
  132. package/types/core/constants.d.ts +341 -0
  133. package/types/core/environment.d.ts +668 -0
  134. package/types/core/friendly_errors/fes_core.d.ts +8 -0
  135. package/types/core/friendly_errors/file_errors.d.ts +8 -0
  136. package/types/core/friendly_errors/param_validator.d.ts +30 -0
  137. package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
  138. package/types/core/friendly_errors/stacktrace.d.ts +11 -0
  139. package/types/core/friendly_errors/validate_params.d.ts +8 -0
  140. package/types/core/helpers.d.ts +8 -0
  141. package/types/core/legacy.d.ts +8 -0
  142. package/types/core/main.d.ts +5996 -0
  143. package/types/core/p5.Graphics.d.ts +484 -0
  144. package/types/core/p5.Renderer.d.ts +14 -0
  145. package/types/core/reference.d.ts +8 -0
  146. package/types/core/rendering.d.ts +481 -0
  147. package/types/core/structure.d.ts +492 -0
  148. package/types/core/transform.d.ts +1638 -0
  149. package/types/data/local_storage.d.ts +323 -0
  150. package/types/dom/dom.d.ts +1295 -0
  151. package/types/dom/p5.Element.d.ts +2011 -0
  152. package/types/dom/p5.File.d.ts +13 -0
  153. package/types/dom/p5.MediaElement.d.ts +1249 -0
  154. package/types/events/acceleration.d.ts +193 -0
  155. package/types/events/keyboard.d.ts +499 -0
  156. package/types/events/pointer.d.ts +782 -0
  157. package/types/global.d.ts +5542 -0
  158. package/types/image/filterRenderer2D.d.ts +54 -0
  159. package/types/image/image.d.ts +326 -0
  160. package/types/image/loading_displaying.d.ts +580 -0
  161. package/types/image/p5.Image.d.ts +5882 -0
  162. package/types/image/pixels.d.ts +832 -0
  163. package/types/io/files.d.ts +1447 -0
  164. package/types/io/p5.Table.d.ts +1247 -0
  165. package/types/io/p5.TableRow.d.ts +343 -0
  166. package/types/io/p5.XML.d.ts +1188 -0
  167. package/types/math/Matrices/Matrix.d.ts +1029 -0
  168. package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
  169. package/types/math/calculation.d.ts +923 -0
  170. package/types/math/math.d.ts +90 -0
  171. package/types/math/noise.d.ts +311 -0
  172. package/types/math/p5.Matrix.d.ts +8 -0
  173. package/types/math/p5.Vector.d.ts +3416 -0
  174. package/types/math/random.d.ts +267 -0
  175. package/types/math/trigonometry.d.ts +663 -0
  176. package/types/p5.d.ts +6663 -0
  177. package/types/shape/2d_primitives.d.ts +1033 -0
  178. package/types/shape/attributes.d.ts +466 -0
  179. package/types/shape/curves.d.ts +740 -0
  180. package/types/shape/custom_shapes.d.ts +888 -0
  181. package/types/shape/vertex.d.ts +1141 -0
  182. package/types/type/p5.Font.d.ts +575 -0
  183. package/types/type/textCore.d.ts +1198 -0
  184. package/types/utilities/conversion.d.ts +894 -0
  185. package/types/utilities/time_date.d.ts +295 -0
  186. package/types/utilities/utility_functions.d.ts +587 -0
  187. package/types/webgl/3d_primitives.d.ts +1432 -0
  188. package/types/webgl/ShaderGenerator.d.ts +8 -0
  189. package/types/webgl/interaction.d.ts +371 -0
  190. package/types/webgl/light.d.ts +1184 -0
  191. package/types/webgl/loading.d.ts +481 -0
  192. package/types/webgl/material.d.ts +2656 -0
  193. package/types/webgl/p5.Camera.d.ts +3023 -0
  194. package/types/webgl/p5.DataArray.d.ts +61 -0
  195. package/types/webgl/p5.Framebuffer.d.ts +760 -0
  196. package/types/webgl/p5.Geometry.d.ts +1191 -0
  197. package/types/webgl/p5.Quat.d.ts +45 -0
  198. package/types/webgl/p5.RendererGL.d.ts +234 -0
  199. package/types/webgl/p5.Shader.d.ts +660 -0
  200. package/types/webgl/p5.Texture.d.ts +61 -0
  201. package/types/webgl/text.d.ts +74 -0
  202. package/src/README.md +0 -27
  203. package/src/accessibility/index.js +0 -13
  204. package/src/app.js +0 -61
  205. package/src/color/index.js +0 -9
  206. package/src/color/p5.Color.culori.js +0 -66
  207. package/src/color/p5.Color.js +0 -851
  208. package/src/core/README.md +0 -91
  209. package/src/core/friendly_errors/index.js +0 -13
  210. package/src/core/friendly_errors/param_validator.js +0 -561
  211. package/src/core/init.js +0 -58
  212. package/src/core/internationalization.js +0 -195
  213. package/src/core/legacy.js +0 -29
  214. package/src/core/main.js +0 -689
  215. package/src/core/noop.js +0 -1
  216. package/src/core/p5.Graphics.js +0 -696
  217. package/src/core/p5.Renderer.js +0 -408
  218. package/src/core/reference.js +0 -2060
  219. package/src/core/rendering.js +0 -697
  220. package/src/dom/index.js +0 -11
  221. package/src/image/const.js +0 -6
  222. package/src/image/image.js +0 -731
  223. package/src/image/index.js +0 -15
  224. package/src/image/loading_displaying.js +0 -1431
  225. package/src/io/files.js +0 -2210
  226. package/src/io/index.js +0 -11
  227. package/src/math/README.md +0 -40
  228. package/src/type/index.js +0 -9
  229. package/src/webgl/3d_primitives.js +0 -2741
  230. package/src/webgl/index.js +0 -37
  231. package/src/webgl/light.js +0 -1851
  232. package/src/webgl/material.js +0 -3854
  233. package/src/webgl/p5.Camera.js +0 -4010
  234. package/src/webgl/p5.Framebuffer.js +0 -1865
  235. package/src/webgl/p5.RendererGL.js +0 -2867
  236. package/src/webgl/p5.Shader.js +0 -1505
  237. package/src/webgl/p5.Texture.js +0 -541
  238. package/src/webgl/shaders/basic.frag +0 -6
  239. package/src/webgl/shaders/filters/base.frag +0 -22
  240. package/src/webgl/shaders/filters/base.vert +0 -19
  241. package/src/webgl/shaders/filters/blur.frag +0 -60
  242. package/src/webgl/shaders/filters/default.vert +0 -18
  243. package/src/webgl/shaders/filters/dilate.frag +0 -39
  244. package/src/webgl/shaders/filters/erode.frag +0 -39
  245. package/src/webgl/shaders/filters/gray.frag +0 -16
  246. package/src/webgl/shaders/filters/invert.frag +0 -15
  247. package/src/webgl/shaders/filters/opaque.frag +0 -12
  248. package/src/webgl/shaders/filters/posterize.frag +0 -29
  249. package/src/webgl/shaders/filters/threshold.frag +0 -23
  250. package/src/webgl/shaders/font.frag +0 -216
  251. package/src/webgl/shaders/font.vert +0 -44
  252. package/src/webgl/shaders/imageLight.vert +0 -33
  253. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  254. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  255. package/src/webgl/shaders/light.vert +0 -37
  256. package/src/webgl/shaders/light_texture.frag +0 -26
  257. package/src/webgl/shaders/lighting.glsl +0 -227
  258. package/src/webgl/shaders/line.frag +0 -74
  259. package/src/webgl/shaders/line.vert +0 -294
  260. package/src/webgl/shaders/normal.frag +0 -6
  261. package/src/webgl/shaders/normal.vert +0 -72
  262. package/src/webgl/shaders/phong.frag +0 -84
  263. package/src/webgl/shaders/phong.vert +0 -87
  264. package/src/webgl/shaders/point.frag +0 -29
  265. package/src/webgl/shaders/point.vert +0 -19
  266. package/src/webgl/shaders/sphereMapping.frag +0 -26
  267. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,5 +1,7 @@
1
1
  import storage from './local_storage.js';
2
2
 
3
- export default function(p5){
3
+ function data(p5){
4
4
  p5.registerAddon(storage);
5
5
  }
6
+
7
+ export { data as default };
@@ -152,9 +152,6 @@ function storage(p5, fn){
152
152
  }
153
153
  value = JSON.stringify(value);
154
154
  break;
155
- case 'string':
156
- default:
157
- break;
158
155
  }
159
156
 
160
157
  localStorage.setItem(key, value);
@@ -302,9 +299,6 @@ function storage(p5, fn){
302
299
  value = JSON.parse(value);
303
300
  value = this.createVector(...value);
304
301
  break;
305
- case 'string':
306
- default:
307
- break;
308
302
  }
309
303
  }
310
304
  return value;
@@ -453,8 +447,8 @@ function storage(p5, fn){
453
447
  };
454
448
  }
455
449
 
456
- export default storage;
457
-
458
450
  if(typeof p5 !== 'undefined'){
459
451
  storage(p5, p5.prototype);
460
452
  }
453
+
454
+ export { storage as default };
@@ -1,3 +1,12 @@
1
+ import { Element } from './p5.Element.js';
2
+ import { MediaElement } from './p5.MediaElement.js';
3
+ import { File } from './p5.File.js';
4
+ import '../creating_reading-Cr8L2Jnm.js';
5
+ import 'colorjs.io/fn';
6
+ import '../color/color_spaces/hsb.js';
7
+ import '../constants-tYr0tCl8.js';
8
+ import '../io/p5.XML.js';
9
+
1
10
  /**
2
11
  * The web is much more than just canvas and the DOM functionality makes it easy to interact
3
12
  * with other HTML5 objects, including text, hyperlink, image, input, video,
@@ -16,9 +25,6 @@
16
25
  * @requires p5
17
26
  */
18
27
 
19
- import { Element } from './p5.Element';
20
- import { MediaElement } from './p5.MediaElement';
21
- import { File } from './p5.File';
22
28
 
23
29
  function dom(p5, fn){
24
30
  /**
@@ -352,7 +358,7 @@ function dom(p5, fn){
352
358
  * let slider;
353
359
  *
354
360
  * function setup() {
355
- * createCanvas(100, 100);
361
+ * createCanvas(200, 200);
356
362
  *
357
363
  * // Create a paragraph element and place
358
364
  * // it at the top of the canvas.
@@ -593,10 +599,10 @@ function dom(p5, fn){
593
599
  * background(200);
594
600
  *
595
601
  * let img = createImg(
596
- * 'https://p5js.org/assets/img/asterisk-01.png',
597
- * 'The p5.js magenta asterisk.'
602
+ * '/assets/cat.jpg',
603
+ * 'image of a cat'
598
604
  * );
599
- * img.position(0, -10);
605
+ * img.position(0, 10);
600
606
  *
601
607
  * describe('A gray square with a magenta asterisk in its center.');
602
608
  * }
@@ -945,7 +951,7 @@ function dom(p5, fn){
945
951
  *
946
952
  * // Create a checkbox and place it beneath the canvas.
947
953
  * checkbox = createCheckbox();
948
- * checkbox.position(0, 100);
954
+ * checkbox.position(0, 70);
949
955
  *
950
956
  * describe('A black square with a checkbox beneath it. The square turns white when the box is checked.');
951
957
  * }
@@ -971,7 +977,7 @@ function dom(p5, fn){
971
977
  * // Create a checkbox and place it beneath the canvas.
972
978
  * // Label the checkbox "white".
973
979
  * checkbox = createCheckbox(' white');
974
- * checkbox.position(0, 100);
980
+ * checkbox.position(0, 70);
975
981
  *
976
982
  * describe('A black square with a checkbox labeled "white" beneath it. The square turns white when the box is checked.');
977
983
  * }
@@ -997,7 +1003,7 @@ function dom(p5, fn){
997
1003
  * // Create a checkbox and place it beneath the canvas.
998
1004
  * // Label the checkbox "white" and set its value to true.
999
1005
  * checkbox = createCheckbox(' white', true);
1000
- * checkbox.position(0, 100);
1006
+ * checkbox.position(0, 70);
1001
1007
  *
1002
1008
  * describe('A white square with a checkbox labeled "white" beneath it. The square turns black when the box is unchecked.');
1003
1009
  * }
@@ -1876,7 +1882,7 @@ function dom(p5, fn){
1876
1882
  * let img;
1877
1883
  *
1878
1884
  * function setup() {
1879
- * createCanvas(100, 100);
1885
+ * createCanvas(200, 200);
1880
1886
  *
1881
1887
  * // Create a file input and place it beneath
1882
1888
  * // the canvas.
@@ -1975,8 +1981,8 @@ function dom(p5, fn){
1975
1981
  };
1976
1982
  }
1977
1983
 
1978
- export default dom;
1979
-
1980
1984
  if(typeof p5 !== 'undefined'){
1981
1985
  dom(p5, p5.prototype);
1982
1986
  }
1987
+
1988
+ export { dom as default };
@@ -0,0 +1,18 @@
1
+ import dom$1 from './dom.js';
2
+ import element from './p5.Element.js';
3
+ import media from './p5.MediaElement.js';
4
+ import file from './p5.File.js';
5
+ import '../creating_reading-Cr8L2Jnm.js';
6
+ import 'colorjs.io/fn';
7
+ import '../color/color_spaces/hsb.js';
8
+ import '../constants-tYr0tCl8.js';
9
+ import '../io/p5.XML.js';
10
+
11
+ function dom(p5){
12
+ p5.registerAddon(dom$1);
13
+ p5.registerAddon(element);
14
+ p5.registerAddon(media);
15
+ p5.registerAddon(file);
16
+ }
17
+
18
+ export { dom as default };
@@ -1,11 +1,15 @@
1
+ import { File } from './p5.File.js';
2
+ import { C as Color } from '../creating_reading-Cr8L2Jnm.js';
3
+ import { w as AUTO } from '../constants-tYr0tCl8.js';
4
+ import '../io/p5.XML.js';
5
+ import 'colorjs.io/fn';
6
+ import '../color/color_spaces/hsb.js';
7
+
1
8
  /**
2
9
  * @module DOM
3
10
  * @submodule DOM
4
11
  */
5
12
 
6
- import { File } from './p5.File';
7
- import { Color } from '../color/p5.Color';
8
- import * as constants from '../core/constants';
9
13
 
10
14
  class Element {
11
15
  width;
@@ -998,11 +1002,11 @@ class Element {
998
1002
  } else {
999
1003
  let aW = w;
1000
1004
  let aH = h;
1001
- const AUTO = constants.AUTO;
1002
- if (aW !== AUTO || aH !== AUTO) {
1003
- if (aW === AUTO) {
1005
+ const AUTO$1 = AUTO;
1006
+ if (aW !== AUTO$1 || aH !== AUTO$1) {
1007
+ if (aW === AUTO$1) {
1004
1008
  aW = h * this.width / this.height;
1005
- } else if (aH === AUTO) {
1009
+ } else if (aH === AUTO$1) {
1006
1010
  aH = w * this.height / this.width;
1007
1011
  }
1008
1012
  // set diff for cnv vs normal div
@@ -2416,8 +2420,7 @@ class Element {
2416
2420
  ctx.elt.removeEventListener(ev, f, false);
2417
2421
  ctx._events[ev] = null;
2418
2422
  }
2419
- };
2420
-
2423
+ }
2421
2424
  function element(p5, fn){
2422
2425
  /**
2423
2426
  * A class to describe an
@@ -2514,9 +2517,8 @@ function element(p5, fn){
2514
2517
  */
2515
2518
  }
2516
2519
 
2517
- export default element;
2518
- export { Element };
2519
-
2520
2520
  if(typeof p5 !== 'undefined'){
2521
2521
  element(p5, p5.prototype);
2522
2522
  }
2523
+
2524
+ export { Element, element as default };
@@ -1,10 +1,11 @@
1
+ import { XML } from '../io/p5.XML.js';
2
+
1
3
  /**
2
4
  * @module DOM
3
5
  * @submodule DOM
4
6
  * @for p5.Element
5
7
  */
6
8
 
7
- import { XML } from '../io/p5.XML';
8
9
 
9
10
  class File {
10
11
  constructor(file, pInst) {
@@ -380,9 +381,8 @@ function file(p5, fn){
380
381
  */
381
382
  }
382
383
 
383
- export default file;
384
- export { File };
385
-
386
384
  if(typeof p5 !== 'undefined'){
387
385
  file(p5, p5.prototype);
388
386
  }
387
+
388
+ export { File, file as default };
@@ -1,9 +1,16 @@
1
+ import { Element } from './p5.Element.js';
2
+ import './p5.File.js';
3
+ import '../io/p5.XML.js';
4
+ import '../creating_reading-Cr8L2Jnm.js';
5
+ import 'colorjs.io/fn';
6
+ import '../color/color_spaces/hsb.js';
7
+ import '../constants-tYr0tCl8.js';
8
+
1
9
  /**
2
10
  * @module DOM
3
11
  * @submodule DOM
4
12
  */
5
13
 
6
- import { Element } from './p5.Element';
7
14
 
8
15
  class MediaElement extends Element {
9
16
  constructor(elt, pInst) {
@@ -1812,9 +1819,8 @@ function media(p5, fn){
1812
1819
  */
1813
1820
  }
1814
1821
 
1815
- export default media;
1816
- export { MediaElement };
1817
-
1818
1822
  if(typeof p5 !== 'undefined'){
1819
1823
  media(p5, p5.prototype);
1820
1824
  }
1825
+
1826
+ export { MediaElement, media as default };
@@ -142,18 +142,18 @@ function acceleration(p5, fn){
142
142
  * @example
143
143
  * <div>
144
144
  * <code>
145
+ * let rotationX = 0; // Angle in degrees
146
+ *
145
147
  * function setup() {
146
- * createCanvas(100, 100, WEBGL);
148
+ * createCanvas(200, 200, WEBGL); // Create 3D canvas
147
149
  * }
148
150
  *
149
151
  * function draw() {
150
- * background(200);
151
- * //rotateZ(radians(rotationZ));
152
- * rotateX(radians(rotationX));
153
- * //rotateY(radians(rotationY));
154
- * box(200, 200, 200);
155
- * describe(`red horizontal line right, green vertical line bottom.
156
- * black background.`);
152
+ * background(220); // Set light gray background
153
+ * rotateX(radians(rotationX)); // Rotate around X-axis
154
+ * normalMaterial(); // Apply simple shaded material
155
+ * box(60); // Draw 3D cube (60 units wide)
156
+ * rotationX = (rotationX + 2) % 360; // Increment rotation (2° per frame)
157
157
  * }
158
158
  * </code>
159
159
  * </div>
@@ -175,18 +175,18 @@ function acceleration(p5, fn){
175
175
  * @example
176
176
  * <div>
177
177
  * <code>
178
+ * let rotationY = 0; // Angle in degrees
179
+ *
178
180
  * function setup() {
179
- * createCanvas(100, 100, WEBGL);
181
+ * createCanvas(200, 200, WEBGL); // Create 3D canvas
180
182
  * }
181
183
  *
182
184
  * function draw() {
183
- * background(200);
184
- * //rotateZ(radians(rotationZ));
185
- * //rotateX(radians(rotationX));
186
- * rotateY(radians(rotationY));
187
- * box(200, 200, 200);
188
- * describe(`red horizontal line right, green vertical line bottom.
189
- * black background.`);
185
+ * background(220); // Set light gray background
186
+ * rotateY(radians(rotationY)); // Rotate around Y-axis (vertical)
187
+ * normalMaterial(); // Apply simple shaded material
188
+ * box(60); // Draw 3D cube (60 units wide)
189
+ * rotationY = (rotationY + 2) % 360; // Increment rotation (2° per frame)
190
190
  * }
191
191
  * </code>
192
192
  * </div>
@@ -209,18 +209,18 @@ function acceleration(p5, fn){
209
209
  * @example
210
210
  * <div>
211
211
  * <code>
212
+ * let rotationZ = 0; // Angle in degrees
213
+ *
212
214
  * function setup() {
213
- * createCanvas(100, 100, WEBGL);
215
+ * createCanvas(200, 200, WEBGL); // Create 3D canvas
214
216
  * }
215
217
  *
216
218
  * function draw() {
217
- * background(200);
218
- * rotateZ(radians(rotationZ));
219
- * //rotateX(radians(rotationX));
220
- * //rotateY(radians(rotationY));
221
- * box(200, 200, 200);
222
- * describe(`red horizontal line right, green vertical line bottom.
223
- * black background.`);
219
+ * background(220);
220
+ * rotateZ(radians(rotationZ)); // Rotate around Z-axis
221
+ * normalMaterial(); // Apply simple shaded material
222
+ * box(60); // Draw 3D cube
223
+ * rotationZ = (rotationZ + 2) % 360; // Increment rotation angle
224
224
  * }
225
225
  * </code>
226
226
  * </div>
@@ -740,8 +740,8 @@ function acceleration(p5, fn){
740
740
  };
741
741
  }
742
742
 
743
- export default acceleration;
744
-
745
743
  if(typeof p5 !== 'undefined'){
746
744
  acceleration(p5, p5.prototype);
747
745
  }
746
+
747
+ export { acceleration as default };
@@ -2,8 +2,10 @@ import acceleration from './acceleration.js';
2
2
  import keyboard from './keyboard.js';
3
3
  import pointer from './pointer.js';
4
4
 
5
- export default function(p5){
5
+ function events(p5){
6
6
  p5.registerAddon(acceleration);
7
7
  p5.registerAddon(keyboard);
8
8
  p5.registerAddon(pointer);
9
9
  }
10
+
11
+ export { events as default };
@@ -4,7 +4,7 @@
4
4
  * @for p5
5
5
  * @requires core
6
6
  */
7
- export function isCode(input) {
7
+ function isCode(input) {
8
8
  const leftRightKeys = [
9
9
  'Alt',
10
10
  'Shift',
@@ -636,6 +636,15 @@ function keyboard(p5, fn){
636
636
  * </div>
637
637
  */
638
638
  fn._onkeyup = function(e) {
639
+
640
+ const context = this._isGlobal ? window : this;
641
+ if (typeof context.keyReleased === 'function') {
642
+ const executeDefault = context.keyReleased(e);
643
+ if (executeDefault === false) {
644
+ e.preventDefault();
645
+ }
646
+ }
647
+
639
648
  delete this._downKeyCodes[e.code];
640
649
  delete this._downKeys[e.key];
641
650
 
@@ -652,13 +661,6 @@ function keyboard(p5, fn){
652
661
  this.key = lastPressedKey;
653
662
  }
654
663
 
655
- const context = this._isGlobal ? window : this;
656
- if (typeof context.keyReleased === 'function') {
657
- const executeDefault = context.keyReleased(e);
658
- if (executeDefault === false) {
659
- e.preventDefault();
660
- }
661
- }
662
664
  };
663
665
 
664
666
  /**
@@ -792,7 +794,7 @@ function keyboard(p5, fn){
792
794
  * </div>
793
795
  */
794
796
  fn._onkeypress = function(e) {
795
- if (e.which === this._lastKeyCodeTyped) {
797
+ if (e.which === this._lastKeyCodeTyped && e.repeat) {
796
798
  // prevent multiple firings
797
799
  return;
798
800
  }
@@ -935,7 +937,7 @@ function keyboard(p5, fn){
935
937
  } else {
936
938
  return this._downKeys[input] || this._downKeyCodes[input] || false;
937
939
  }
938
- }
940
+ };
939
941
  /**
940
942
  * The _areDownKeys function returns a boolean true if any keys pressed
941
943
  * and a false if no keys are currently pressed.
@@ -955,8 +957,8 @@ function keyboard(p5, fn){
955
957
  };
956
958
  }
957
959
 
958
- export default keyboard;
959
-
960
960
  if(typeof p5 !== 'undefined'){
961
961
  keyboard(p5, p5.prototype);
962
962
  }
963
+
964
+ export { keyboard as default, isCode };
@@ -6,7 +6,6 @@
6
6
  * @requires constants
7
7
  */
8
8
 
9
- import * as constants from '../core/constants';
10
9
 
11
10
  function pointer(p5, fn){
12
11
  /**
@@ -912,25 +911,25 @@ function pointer(p5, fn){
912
911
 
913
912
  fn._updatePointerCoords = function (e) {
914
913
  if (this._curElement !== null) {
915
- const canvas = this._curElement.elt;
916
- const sx = canvas.scrollWidth / this.width || 1;
917
- const sy = canvas.scrollHeight / this.height || 1;
914
+ const canvas = this._curElement.elt;
915
+ const sx = canvas.scrollWidth / this.width || 1;
916
+ const sy = canvas.scrollHeight / this.height || 1;
918
917
 
919
- if (e.pointerType == 'touch') {
918
+ if (e.pointerType == 'touch') {
920
919
  const touches = [];
921
920
  for (const touch of this._activePointers.values()) {
922
- touches.push(getTouchInfo(canvas, sx, sy, touch));
921
+ touches.push(getTouchInfo(canvas, sx, sy, touch));
923
922
  }
924
923
  this.touches = touches;
925
- } else {
926
- const mousePos = getMouseInfo(canvas, sx, sy, e);
927
- this.movedX = e.movementX || 0;
928
- this.movedY = e.movementY || 0;
929
- this.mouseX = mousePos.x;
930
- this.mouseY = mousePos.y;
931
- this.winMouseX = mousePos.winX;
932
- this.winMouseY = mousePos.winY;
933
- }
924
+ }
925
+
926
+ const mousePos = getMouseInfo(canvas, sx, sy, e);
927
+ this.movedX = e.movementX || 0;
928
+ this.movedY = e.movementY || 0;
929
+ this.mouseX = mousePos.x;
930
+ this.mouseY = mousePos.y;
931
+ this.winMouseX = mousePos.winX;
932
+ this.winMouseY = mousePos.winY;
934
933
 
935
934
  if (!this._hasMouseInteracted) {
936
935
  this._updateMouseCoords();
@@ -2059,8 +2058,8 @@ fn._setMouseButton = function(e) {
2059
2058
  };
2060
2059
  }
2061
2060
 
2062
- export default pointer;
2063
-
2064
2061
  if(typeof p5 !== 'undefined'){
2065
2062
  pointer(p5, p5.prototype);
2066
2063
  }
2064
+
2065
+ export { pointer as default };
@@ -0,0 +1,9 @@
1
+ import { Z as THRESHOLD, U as POSTERIZE, $ as BLUR } from '../constants-tYr0tCl8.js';
2
+
3
+ const filterParamDefaults = {
4
+ [BLUR]: 3,
5
+ [POSTERIZE]: 4,
6
+ [THRESHOLD]: 0.5,
7
+ };
8
+
9
+ export { filterParamDefaults };
@@ -1,23 +1,43 @@
1
- import { Shader } from "../webgl/p5.Shader";
2
- import { Texture } from "../webgl/p5.Texture";
3
- import { Image } from "./p5.Image";
4
- import * as constants from '../core/constants';
5
-
6
- import filterGrayFrag from '../webgl/shaders/filters/gray.frag';
7
- import filterErodeFrag from '../webgl/shaders/filters/erode.frag';
8
- import filterDilateFrag from '../webgl/shaders/filters/dilate.frag';
9
- import filterBlurFrag from '../webgl/shaders/filters/blur.frag';
10
- import filterPosterizeFrag from '../webgl/shaders/filters/posterize.frag';
11
- import filterOpaqueFrag from '../webgl/shaders/filters/opaque.frag';
12
- import filterInvertFrag from '../webgl/shaders/filters/invert.frag';
13
- import filterThresholdFrag from '../webgl/shaders/filters/threshold.frag';
14
- import filterShaderVert from '../webgl/shaders/filters/default.vert';
15
- import { filterParamDefaults } from "./const";
16
-
17
-
18
- import filterBaseFrag from "../webgl/shaders/filters/base.frag";
19
- import filterBaseVert from "../webgl/shaders/filters/base.vert";
20
- import webgl2CompatibilityShader from "../webgl/shaders/webgl2Compatibility.glsl";
1
+ import { T as Texture, e as filterOpaqueFrag, g as filterPosterizeFrag, h as filterDilateFrag, j as filterGrayFrag, k as filterErodeFrag, n as filterThresholdFrag, o as filterInvertFrag, q as filterBlurFrag, S as Shader, w as webgl2CompatibilityShader, u as filterBaseVert, v as filterBaseFrag, x as filterShaderVert } from '../rendering-B5TRR7aY.js';
2
+ import { I as Image } from '../p5.Renderer-Swjl9HQO.js';
3
+ import { z as WEBGL2, K as OPAQUE, U as POSTERIZE, V as DILATE, X as GRAY, Y as ERODE, Z as THRESHOLD, _ as INVERT, $ as BLUR, e as CORNER, u as BLEND, a0 as WEBGL } from '../constants-tYr0tCl8.js';
4
+ import { filterParamDefaults } from './const.js';
5
+ import '../creating_reading-Cr8L2Jnm.js';
6
+ import 'colorjs.io/fn';
7
+ import '../color/color_spaces/hsb.js';
8
+ import '../dom/p5.Element.js';
9
+ import '../dom/p5.File.js';
10
+ import '../io/p5.XML.js';
11
+ import '../dom/p5.MediaElement.js';
12
+ import '../shape/2d_primitives.js';
13
+ import '../core/helpers.js';
14
+ import '../shape/attributes.js';
15
+ import '../shape/curves.js';
16
+ import '../shape/vertex.js';
17
+ import '../color/setting.js';
18
+ import 'omggif';
19
+ import '../io/csv.js';
20
+ import '../io/utilities.js';
21
+ import 'file-saver';
22
+ import 'gifenc';
23
+ import './pixels.js';
24
+ import './filters.js';
25
+ import '../core/transform.js';
26
+ import '../webgl/GeometryBuilder.js';
27
+ import '../math/p5.Matrix.js';
28
+ import '../math/Matrices/Matrix.js';
29
+ import '../math/p5.Vector.js';
30
+ import '../math/Matrices/MatrixInterface.js';
31
+ import '../webgl/p5.Geometry.js';
32
+ import '../webgl/p5.DataArray.js';
33
+ import '../webgl/p5.Quat.js';
34
+ import '../webgl/p5.RenderBuffer.js';
35
+ import '../webgl/ShapeBuilder.js';
36
+ import 'libtess';
37
+ import '../webgl/GeometryBufferCache.js';
38
+ import '../shape/custom_shapes.js';
39
+ import '../math/trigonometry.js';
40
+ import '../core/States.js';
21
41
 
22
42
  class FilterRenderer2D {
23
43
  /**
@@ -32,10 +52,10 @@ class FilterRenderer2D {
32
52
  this.canvas.height = pInst.height;
33
53
 
34
54
  // Initialize the WebGL context
35
- let webglVersion = constants.WEBGL2;
55
+ let webglVersion = WEBGL2;
36
56
  this.gl = this.canvas.getContext('webgl2');
37
57
  if (!this.gl) {
38
- webglVersion = constants.WEBGL;
58
+ webglVersion = WEBGL;
39
59
  this.gl = this.canvas.getContext('webgl');
40
60
  }
41
61
  if (!this.gl) {
@@ -68,14 +88,14 @@ class FilterRenderer2D {
68
88
 
69
89
  // Store the fragment shader sources
70
90
  this.filterShaderSources = {
71
- [constants.BLUR]: filterBlurFrag,
72
- [constants.INVERT]: filterInvertFrag,
73
- [constants.THRESHOLD]: filterThresholdFrag,
74
- [constants.ERODE]: filterErodeFrag,
75
- [constants.GRAY]: filterGrayFrag,
76
- [constants.DILATE]: filterDilateFrag,
77
- [constants.POSTERIZE]: filterPosterizeFrag,
78
- [constants.OPAQUE]: filterOpaqueFrag,
91
+ [BLUR]: filterBlurFrag,
92
+ [INVERT]: filterInvertFrag,
93
+ [THRESHOLD]: filterThresholdFrag,
94
+ [ERODE]: filterErodeFrag,
95
+ [GRAY]: filterGrayFrag,
96
+ [DILATE]: filterDilateFrag,
97
+ [POSTERIZE]: filterPosterizeFrag,
98
+ [OPAQUE]: filterOpaqueFrag,
79
99
  };
80
100
 
81
101
  // Store initialized shaders for each operation
@@ -104,7 +124,7 @@ class FilterRenderer2D {
104
124
 
105
125
  _webGL2CompatibilityPrefix(shaderType, floatPrecision) {
106
126
  let code = "";
107
- if (this._renderer.webglVersion === constants.WEBGL2) {
127
+ if (this._renderer.webglVersion === WEBGL2) {
108
128
  code += "#version 300 es\n#define WEBGL2\n";
109
129
  }
110
130
  if (shaderType === "vert") {
@@ -236,9 +256,9 @@ class FilterRenderer2D {
236
256
  this._shader.setUniform('filterParameter', this.filterParameter);
237
257
  this._shader.setDefaultUniforms();
238
258
 
239
- this.pInst.states.setValue('rectMode', constants.CORNER);
240
- this.pInst.states.setValue('imageMode', constants.CORNER);
241
- this.pInst.blendMode(constants.BLEND);
259
+ this.pInst.states.setValue('rectMode', CORNER);
260
+ this.pInst.states.setValue('imageMode', CORNER);
261
+ this.pInst.blendMode(BLEND);
242
262
  this.pInst.resetMatrix();
243
263
 
244
264
 
@@ -277,7 +297,7 @@ class FilterRenderer2D {
277
297
  this.pInst.push();
278
298
  this.pInst.resetMatrix();
279
299
  // For blur, we typically do two passes: one horizontal, one vertical.
280
- if (this.operation === constants.BLUR && !this.customShader) {
300
+ if (this.operation === BLUR && !this.customShader) {
281
301
  // Horizontal pass
282
302
  this._shader.setUniform('direction', [1, 0]);
283
303
  this._renderPass();
@@ -298,7 +318,7 @@ class FilterRenderer2D {
298
318
  this._renderPass();
299
319
  this.pInst.clear();
300
320
  // con
301
- this.pInst.blendMode(constants.BLEND);
321
+ this.pInst.blendMode(BLEND);
302
322
 
303
323
 
304
324
  this.pInst.drawingContext.drawImage(this.canvas, 0, 0, this.pInst.width, this.pInst.height);
@@ -307,4 +327,4 @@ class FilterRenderer2D {
307
327
  }
308
328
  }
309
329
 
310
- export default FilterRenderer2D;
330
+ export { FilterRenderer2D as default };
@@ -659,6 +659,4 @@ function blurARGB(canvas, radius) {
659
659
  Filters._setPixels(pixels, argb);
660
660
  }
661
661
 
662
-
663
-
664
- export default Filters;
662
+ export { Filters as default };