p5 2.0.0 → 2.0.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 (188) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +2 -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 +2 -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-C-g_eAdC.js} +266 -130
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +7 -6
  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 +5455 -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-D4AAKRbx.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 +11 -5
  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 +2 -2
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -11
  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 +4 -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 +3 -4
  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-s72KWcUy.js} +735 -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 +2 -2
  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-CwAYZOC2.js} +390 -19
  81. package/dist/rendering--aAe5aq3.js +24925 -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 -61
  91. package/{src → dist}/type/textCore.js +34 -57
  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 +51 -9
  117. package/lib/p5.esm.js +102 -48
  118. package/lib/p5.js +102 -48
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -16
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/src/README.md +0 -27
  124. package/src/accessibility/index.js +0 -13
  125. package/src/app.js +0 -61
  126. package/src/color/index.js +0 -9
  127. package/src/color/p5.Color.culori.js +0 -66
  128. package/src/color/p5.Color.js +0 -851
  129. package/src/core/README.md +0 -91
  130. package/src/core/friendly_errors/index.js +0 -13
  131. package/src/core/friendly_errors/param_validator.js +0 -561
  132. package/src/core/init.js +0 -58
  133. package/src/core/internationalization.js +0 -195
  134. package/src/core/legacy.js +0 -29
  135. package/src/core/main.js +0 -689
  136. package/src/core/noop.js +0 -1
  137. package/src/core/p5.Graphics.js +0 -696
  138. package/src/core/p5.Renderer.js +0 -408
  139. package/src/core/reference.js +0 -2060
  140. package/src/core/rendering.js +0 -697
  141. package/src/dom/index.js +0 -11
  142. package/src/image/const.js +0 -6
  143. package/src/image/image.js +0 -731
  144. package/src/image/index.js +0 -15
  145. package/src/image/loading_displaying.js +0 -1431
  146. package/src/io/files.js +0 -2210
  147. package/src/io/index.js +0 -11
  148. package/src/math/README.md +0 -40
  149. package/src/type/index.js +0 -9
  150. package/src/webgl/3d_primitives.js +0 -2741
  151. package/src/webgl/index.js +0 -37
  152. package/src/webgl/light.js +0 -1851
  153. package/src/webgl/material.js +0 -3854
  154. package/src/webgl/p5.Camera.js +0 -4010
  155. package/src/webgl/p5.Framebuffer.js +0 -1865
  156. package/src/webgl/p5.RendererGL.js +0 -2867
  157. package/src/webgl/p5.Shader.js +0 -1505
  158. package/src/webgl/p5.Texture.js +0 -541
  159. package/src/webgl/shaders/basic.frag +0 -6
  160. package/src/webgl/shaders/filters/base.frag +0 -22
  161. package/src/webgl/shaders/filters/base.vert +0 -19
  162. package/src/webgl/shaders/filters/blur.frag +0 -60
  163. package/src/webgl/shaders/filters/default.vert +0 -18
  164. package/src/webgl/shaders/filters/dilate.frag +0 -39
  165. package/src/webgl/shaders/filters/erode.frag +0 -39
  166. package/src/webgl/shaders/filters/gray.frag +0 -16
  167. package/src/webgl/shaders/filters/invert.frag +0 -15
  168. package/src/webgl/shaders/filters/opaque.frag +0 -12
  169. package/src/webgl/shaders/filters/posterize.frag +0 -29
  170. package/src/webgl/shaders/filters/threshold.frag +0 -23
  171. package/src/webgl/shaders/font.frag +0 -216
  172. package/src/webgl/shaders/font.vert +0 -44
  173. package/src/webgl/shaders/imageLight.vert +0 -33
  174. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  175. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  176. package/src/webgl/shaders/light.vert +0 -37
  177. package/src/webgl/shaders/light_texture.frag +0 -26
  178. package/src/webgl/shaders/lighting.glsl +0 -227
  179. package/src/webgl/shaders/line.frag +0 -74
  180. package/src/webgl/shaders/line.vert +0 -294
  181. package/src/webgl/shaders/normal.frag +0 -6
  182. package/src/webgl/shaders/normal.vert +0 -72
  183. package/src/webgl/shaders/phong.frag +0 -84
  184. package/src/webgl/shaders/phong.vert +0 -87
  185. package/src/webgl/shaders/point.frag +0 -29
  186. package/src/webgl/shaders/point.vert +0 -19
  187. package/src/webgl/shaders/sphereMapping.frag +0 -26
  188. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,8 +1,50 @@
1
- import * as constants from "../core/constants";
2
- import { RendererGL } from "./p5.RendererGL";
3
- import { Vector } from "../math/p5.Vector";
4
- import { Geometry } from "./p5.Geometry";
5
- import { Font, arrayCommandsToObjects } from "../type/p5.Font";
1
+ import { T as TEXTURE } from '../constants-C-g_eAdC.js';
2
+ import { R as RendererGL } from '../rendering--aAe5aq3.js';
3
+ import { Vector } from '../math/p5.Vector.js';
4
+ import { Geometry } from './p5.Geometry.js';
5
+ import { Font, arrayCommandsToObjects } from '../type/p5.Font.js';
6
+ import '../creating_reading-D4AAKRbx.js';
7
+ import 'colorjs.io/fn';
8
+ import '../color/color_spaces/hsb.js';
9
+ import '../dom/p5.Element.js';
10
+ import '../dom/p5.File.js';
11
+ import '../io/p5.XML.js';
12
+ import '../p5.Renderer-CwAYZOC2.js';
13
+ import '../image/filters.js';
14
+ import '../shape/custom_shapes.js';
15
+ import '../core/States.js';
16
+ import '../io/utilities.js';
17
+ import 'file-saver';
18
+ import '../dom/p5.MediaElement.js';
19
+ import '../shape/2d_primitives.js';
20
+ import '../core/helpers.js';
21
+ import '../shape/attributes.js';
22
+ import '../shape/curves.js';
23
+ import '../shape/vertex.js';
24
+ import '../color/setting.js';
25
+ import 'omggif';
26
+ import '../io/csv.js';
27
+ import 'gifenc';
28
+ import '../image/pixels.js';
29
+ import '../core/transform.js';
30
+ import './GeometryBuilder.js';
31
+ import '../math/p5.Matrix.js';
32
+ import '../math/Matrices/Matrix.js';
33
+ import '../math/Matrices/MatrixInterface.js';
34
+ import './p5.Quat.js';
35
+ import './p5.RenderBuffer.js';
36
+ import './p5.DataArray.js';
37
+ import './ShapeBuilder.js';
38
+ import 'libtess';
39
+ import './GeometryBufferCache.js';
40
+ import '../image/const.js';
41
+ import '../math/trigonometry.js';
42
+ import '../type/textCore.js';
43
+ import '@japont/unicode-range';
44
+ import '../type/unicodeRanges.js';
45
+ import '../type/lib/Typr.js';
46
+ import 'pako';
47
+ import '@davepagurek/bezier-path';
6
48
 
7
49
  function text(p5, fn) {
8
50
  RendererGL.prototype.maxCachedGlyphs = function() {
@@ -25,7 +67,7 @@ function text(p5, fn) {
25
67
  this.textures.delete(data);
26
68
  }
27
69
  }
28
- }
70
+ };
29
71
 
30
72
  Font.prototype._getFontInfo = function(axs) {
31
73
  // For WebGL, a cache of font data to use on the GPU.
@@ -40,7 +82,7 @@ function text(p5, fn) {
40
82
  this._fontInfos[key] = val;
41
83
  return val;
42
84
  }
43
- }
85
+ };
44
86
 
45
87
  // Text/Typography (see src/type/textCore.js)
46
88
  /*
@@ -716,7 +758,7 @@ function text(p5, fn) {
716
758
  const drawMode = this.states.drawMode;
717
759
 
718
760
  this.states.setValue("strokeColor", null);
719
- this.states.setValue("drawMode", constants.TEXTURE);
761
+ this.states.setValue("drawMode", TEXTURE);
720
762
 
721
763
  // get the cached FontInfo object
722
764
  const { font } = this.states.textFont;
@@ -843,4 +885,4 @@ function text(p5, fn) {
843
885
  };
844
886
  }
845
887
 
846
- export default text;
888
+ export { text as default };
package/lib/p5.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! p5.js v2.0.0 April 17, 2025 */
1
+ /*! p5.js v2.0.1 April 23, 2025 */
2
2
  /**
3
3
  * @module Constants
4
4
  * @submodule Constants
@@ -12,7 +12,7 @@ const _PI = Math.PI;
12
12
  * @property {String} VERSION
13
13
  * @final
14
14
  */
15
- const VERSION = '2.0.0';
15
+ const VERSION = '2.0.1';
16
16
 
17
17
  // GRAPHICS RENDERER
18
18
  /**
@@ -52867,7 +52867,7 @@ var lightTextureFrag = "uniform vec4 uTint;\nuniform sampler2D uSampler;\nunifor
52867
52867
 
52868
52868
  var phongVert = "precision highp int;\n\n#define HOOK_DEFINES\n\nIN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\nuniform vec3 uAmbientColor[5];\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat3 uModelNormalMatrix;\nuniform mat3 uCameraNormalMatrix;\n#else\nuniform mat4 uModelViewMatrix;\nuniform mat3 uNormalMatrix;\n#endif\nuniform mat4 uProjectionMatrix;\nuniform int uAmbientLightCount;\n\nuniform bool uUseVertexColor;\nuniform vec4 uMaterialColor;\n\nOUT vec3 vNormal;\nOUT vec2 vTexCoord;\nOUT vec3 vViewPosition;\nOUT vec3 vAmbientColor;\nOUT vec4 vColor;\n\nstruct Vertex {\n vec3 position;\n vec3 normal;\n vec2 texCoord;\n vec4 color;\n};\n\nvoid main(void) {\n HOOK_beforeVertex();\n\n Vertex inputs;\n inputs.position = aPosition;\n inputs.normal = aNormal;\n inputs.texCoord = aTexCoord;\n inputs.color = (uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor;\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uModelNormalMatrix * inputs.normal;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uCameraNormalMatrix * inputs.normal;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uNormalMatrix * inputs.normal;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = HOOK_getCameraInputs(inputs);\n#endif\n\n // Pass varyings to fragment shader\n vViewPosition = inputs.position;\n vTexCoord = inputs.texCoord;\n vNormal = inputs.normal;\n vColor = inputs.color;\n\n // TODO: this should be a uniform\n vAmbientColor = vec3(0.0);\n for (int i = 0; i < 5; i++) {\n if (i < uAmbientLightCount) {\n vAmbientColor += uAmbientColor[i];\n }\n }\n\n gl_Position = uProjectionMatrix * vec4(inputs.position, 1.);\n HOOK_afterVertex();\n}\n";
52869
52869
 
52870
- var phongFrag = "// include lighting.glsl\nprecision highp int;\n\nuniform bool uHasSetAmbient;\nuniform vec4 uSpecularMatColor;\nuniform vec4 uAmbientMatColor;\nuniform vec4 uEmissiveMatColor;\n\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nIN vec3 vNormal;\nIN vec2 vTexCoord;\nIN vec3 vViewPosition;\nIN vec3 vAmbientColor;\nIN vec4 vColor;\n\nstruct ColorComponents {\n vec3 baseColor;\n float opacity;\n vec3 ambientColor;\n vec3 specularColor;\n vec3 diffuse;\n vec3 ambient;\n vec3 specular;\n vec3 emissive;\n};\n\nstruct Inputs {\n vec3 normal;\n vec2 texCoord;\n vec3 ambientLight;\n vec3 ambientMaterial;\n vec3 specularMaterial;\n vec3 emissiveMaterial;\n vec4 color;\n float shininess;\n float metalness;\n};\n\nvoid main(void) {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.normal = normalize(vNormal);\n inputs.texCoord = vTexCoord;\n inputs.ambientLight = vAmbientColor;\n inputs.color = isTexture\n ? TEXTURE(uSampler, vTexCoord) * uTint/255.\n : vColor;\n if (isTexture && inputs.color.a > 0.0) {\n // Textures come in with premultiplied alpha. Temporarily unpremultiply it\n // so hooks users don't have to think about premultiplied alpha.\n inputs.color.rgb /= inputs.color.a;\n }\n inputs.shininess = uShininess;\n inputs.metalness = uMetallic;\n inputs.ambientMaterial = uHasSetAmbient ? uAmbientMatColor.rgb : inputs.color.rgb;\n inputs.specularMaterial = uSpecularMatColor.rgb;\n inputs.emissiveMaterial = uEmissiveMatColor.rgb;\n inputs = HOOK_getPixelInputs(inputs);\n\n vec3 diffuse;\n vec3 specular;\n totalLight(vViewPosition, inputs.normal, inputs.shininess, inputs.metalness, diffuse, specular);\n\n // Calculating final color as result of all lights (plus emissive term).\n\n vec2 texCoord = inputs.texCoord;\n vec4 baseColor = inputs.color;\n ColorComponents c;\n c.opacity = baseColor.a;\n c.baseColor = baseColor.rgb;\n c.ambientColor = inputs.ambientMaterial;\n c.specularColor = inputs.specularMaterial;\n c.diffuse = diffuse;\n c.ambient = inputs.ambientLight;\n c.specular = specular;\n c.emissive = inputs.emissiveMaterial;\n OUT_COLOR = HOOK_getFinalColor(HOOK_combineColors(c));\n OUT_COLOR.rgb *= OUT_COLOR.a; // Premultiply alpha before rendering\n HOOK_afterFragment();\n}\n";
52870
+ var phongFrag = "// include lighting.glsl\nprecision highp int;\n\nuniform bool uHasSetAmbient;\nuniform vec4 uSpecularMatColor;\nuniform vec4 uAmbientMatColor;\nuniform vec4 uEmissiveMatColor;\n\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nIN vec3 vNormal;\nIN vec2 vTexCoord;\nIN vec3 vViewPosition;\nIN vec3 vAmbientColor;\nIN vec4 vColor;\n\nstruct ColorComponents {\n vec3 baseColor;\n float opacity;\n vec3 ambientColor;\n vec3 specularColor;\n vec3 diffuse;\n vec3 ambient;\n vec3 specular;\n vec3 emissive;\n};\n\nstruct Inputs {\n vec3 normal;\n vec2 texCoord;\n vec3 ambientLight;\n vec3 ambientMaterial;\n vec3 specularMaterial;\n vec3 emissiveMaterial;\n vec4 color;\n float shininess;\n float metalness;\n};\n\nvoid main(void) {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.normal = normalize(vNormal);\n inputs.texCoord = vTexCoord;\n inputs.ambientLight = vAmbientColor;\n inputs.color = isTexture\n ? TEXTURE(uSampler, vTexCoord) * (vec4(uTint.rgb/255., 1.) * uTint.a/255.)\n : vColor;\n if (isTexture && inputs.color.a > 0.0) {\n // Textures come in with premultiplied alpha. Temporarily unpremultiply it\n // so hooks users don't have to think about premultiplied alpha.\n inputs.color.rgb /= inputs.color.a;\n }\n inputs.shininess = uShininess;\n inputs.metalness = uMetallic;\n inputs.ambientMaterial = uHasSetAmbient ? uAmbientMatColor.rgb : inputs.color.rgb;\n inputs.specularMaterial = uSpecularMatColor.rgb;\n inputs.emissiveMaterial = uEmissiveMatColor.rgb;\n inputs = HOOK_getPixelInputs(inputs);\n\n vec3 diffuse;\n vec3 specular;\n totalLight(vViewPosition, inputs.normal, inputs.shininess, inputs.metalness, diffuse, specular);\n\n // Calculating final color as result of all lights (plus emissive term).\n\n vec2 texCoord = inputs.texCoord;\n vec4 baseColor = inputs.color;\n ColorComponents c;\n c.opacity = baseColor.a;\n c.baseColor = baseColor.rgb;\n c.ambientColor = inputs.ambientMaterial;\n c.specularColor = inputs.specularMaterial;\n c.diffuse = diffuse;\n c.ambient = inputs.ambientLight;\n c.specular = specular;\n c.emissive = inputs.emissiveMaterial;\n OUT_COLOR = HOOK_getFinalColor(HOOK_combineColors(c));\n OUT_COLOR.rgb *= OUT_COLOR.a; // Premultiply alpha before rendering\n HOOK_afterFragment();\n}\n";
52871
52871
 
52872
52872
  var fontVert = "IN vec3 aPosition;\nIN vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uGlyphRect;\nuniform float uGlyphOffset;\n\nOUT vec2 vTexCoord;\nOUT float w;\n\nvoid main() {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // scale by the size of the glyph's rectangle\n positionVec4.xy *= uGlyphRect.zw - uGlyphRect.xy;\n\n // Expand glyph bounding boxes by 1px on each side to give a bit of room\n // for antialiasing\n vec3 newOrigin = (uModelViewMatrix * vec4(0., 0., 0., 1.)).xyz;\n vec3 newDX = (uModelViewMatrix * vec4(1., 0., 0., 1.)).xyz;\n vec3 newDY = (uModelViewMatrix * vec4(0., 1., 0., 1.)).xyz;\n vec2 pixelScale = vec2(\n 1. / length(newOrigin - newDX),\n 1. / length(newOrigin - newDY)\n );\n vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5));\n vec2 textureOffset = offset * (1. / vec2(\n uGlyphRect.z - uGlyphRect.x,\n uGlyphRect.w - uGlyphRect.y\n ));\n\n // move to the corner of the glyph\n positionVec4.xy += uGlyphRect.xy;\n\n // move to the letter's line offset\n positionVec4.x += uGlyphOffset;\n\n positionVec4.xy += offset;\n \n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vTexCoord = aTexCoord + textureOffset;\n w = gl_Position.w;\n}\n";
52873
52873
 
@@ -65646,6 +65646,7 @@ function graphics(p5, fn){
65646
65646
  attributes(p5, p5.Graphics.prototype);
65647
65647
  curves(p5, p5.Graphics.prototype);
65648
65648
  vertex(p5, p5.Graphics.prototype);
65649
+ customShapes(p5, p5.Graphics.prototype);
65649
65650
 
65650
65651
  setting(p5, p5.Graphics.prototype);
65651
65652
  loadingDisplaying(p5, p5.Graphics.prototype);
@@ -70086,9 +70087,10 @@ function renderer2D(p5, fn){
70086
70087
  * a p5 sketch. It expects an incoming sketch closure and it can also
70087
70088
  * take an optional node parameter for attaching the generated p5 canvas
70088
70089
  * to a node. The sketch closure takes the newly created p5 instance as
70089
- * its sole argument and may optionally set <a href="#/p5/preload">preload()</a>,
70090
- * <a href="#/p5/setup">setup()</a>, and/or
70091
- * <a href="#/p5/draw">draw()</a> properties on it for running a sketch.
70090
+ * its sole argument and may optionally set an asynchronous function
70091
+ * using `async/await`, along with the standard <a href="#/p5/setup">setup()</a>,
70092
+ * and/or <a href="#/p5/setup">setup()</a>, and/or <a href="#/p5/draw">draw()</a>
70093
+ * properties on it for running a sketch.
70092
70094
  *
70093
70095
  * A p5 sketch can run in "global" or "instance" mode:
70094
70096
  * "global" - all properties and methods are attached to the window
@@ -70209,10 +70211,11 @@ let p5$2 = class p5 {
70209
70211
  bindGlobal(p);
70210
70212
  }
70211
70213
 
70214
+ const protectedProperties = ['constructor', 'length'];
70212
70215
  // Attach its properties to the window
70213
70216
  for (const p in this) {
70214
70217
  if (this.hasOwnProperty(p)) {
70215
- if(p[0] === '_') continue;
70218
+ if(p[0] === '_' || protectedProperties.includes(p)) continue;
70216
70219
  bindGlobal(p);
70217
70220
  }
70218
70221
  }
@@ -70537,6 +70540,8 @@ for (const k in constants) {
70537
70540
  * <a href="#/p5/draw">draw()</a> begins looping. If the
70538
70541
  * <a href="#/p5/preload">preload()</a> is declared, then `setup()` will
70539
70542
  * run immediately after <a href="#/p5/preload">preload()</a> finishes
70543
+ *
70544
+ *
70540
70545
  * loading assets.
70541
70546
  *
70542
70547
  * Note: `setup()` doesn’t have to be declared, but it’s common practice to do so.
@@ -76716,7 +76721,7 @@ function fesCore(p5, fn){
76716
76721
  // actual name with correct capitalization doesnt exist in context,
76717
76722
  // and if the user-defined symbol is of the type function
76718
76723
  if (
76719
- fxns[lowercase] &&
76724
+ fxns.hasOwnProperty(lowercase) &&
76720
76725
  !context[fxns[lowercase]] &&
76721
76726
  typeof context[prop] === 'function'
76722
76727
  ) {
@@ -83261,6 +83266,13 @@ var p5$1 = {
83261
83266
  ]
83262
83267
  ]
83263
83268
  },
83269
+ createMatrix: {
83270
+ overloads: [
83271
+ [
83272
+ "Number[]"
83273
+ ]
83274
+ ]
83275
+ },
83264
83276
  noise: {
83265
83277
  overloads: [
83266
83278
  [
@@ -83683,23 +83695,14 @@ var p5$1 = {
83683
83695
  bezierOrder: {
83684
83696
  overloads: [
83685
83697
  [
83686
- "Number"
83687
83698
  ],
83688
83699
  [
83700
+ "Number"
83689
83701
  ]
83690
83702
  ]
83691
83703
  },
83692
83704
  splineVertex: {
83693
83705
  overloads: [
83694
- [
83695
- "Number",
83696
- "Number"
83697
- ],
83698
- [
83699
- "Number",
83700
- "Number",
83701
- "Number?"
83702
- ],
83703
83706
  [
83704
83707
  "Number",
83705
83708
  "Number",
@@ -83718,20 +83721,20 @@ var p5$1 = {
83718
83721
  splineProperty: {
83719
83722
  overloads: [
83720
83723
  [
83721
- "String",
83722
- null
83724
+ "String"
83723
83725
  ],
83724
83726
  [
83725
- "String"
83727
+ "String",
83728
+ null
83726
83729
  ]
83727
83730
  ]
83728
83731
  },
83729
83732
  splineProperties: {
83730
83733
  overloads: [
83731
83734
  [
83732
- "Object"
83733
83735
  ],
83734
83736
  [
83737
+ "Object"
83735
83738
  ]
83736
83739
  ]
83737
83740
  },
@@ -83793,6 +83796,19 @@ var p5$1 = {
83793
83796
  ]
83794
83797
  ]
83795
83798
  },
83799
+ curveVertex: {
83800
+ overloads: [
83801
+ [
83802
+ "Number",
83803
+ "Number"
83804
+ ],
83805
+ [
83806
+ "Number",
83807
+ "Number",
83808
+ "Number?"
83809
+ ]
83810
+ ]
83811
+ },
83796
83812
  endShape: {
83797
83813
  overloads: [
83798
83814
  [
@@ -84599,6 +84615,42 @@ var p5$1 = {
84599
84615
  ]
84600
84616
  ]
84601
84617
  },
84618
+ parseObj: {
84619
+ overloads: [
84620
+ [
84621
+ ]
84622
+ ]
84623
+ },
84624
+ parseSTL: {
84625
+ overloads: [
84626
+ [
84627
+ ]
84628
+ ]
84629
+ },
84630
+ isBinary: {
84631
+ overloads: [
84632
+ [
84633
+ ]
84634
+ ]
84635
+ },
84636
+ matchDataViewAt: {
84637
+ overloads: [
84638
+ [
84639
+ ]
84640
+ ]
84641
+ },
84642
+ parseBinarySTL: {
84643
+ overloads: [
84644
+ [
84645
+ ]
84646
+ ]
84647
+ },
84648
+ parseASCIISTL: {
84649
+ overloads: [
84650
+ [
84651
+ ]
84652
+ ]
84653
+ },
84602
84654
  model: {
84603
84655
  overloads: [
84604
84656
  [
@@ -97784,6 +97836,15 @@ function keyboard(p5, fn){
97784
97836
  * </div>
97785
97837
  */
97786
97838
  fn._onkeyup = function(e) {
97839
+
97840
+ const context = this._isGlobal ? window : this;
97841
+ if (typeof context.keyReleased === 'function') {
97842
+ const executeDefault = context.keyReleased(e);
97843
+ if (executeDefault === false) {
97844
+ e.preventDefault();
97845
+ }
97846
+ }
97847
+
97787
97848
  delete this._downKeyCodes[e.code];
97788
97849
  delete this._downKeys[e.key];
97789
97850
 
@@ -97800,15 +97861,9 @@ function keyboard(p5, fn){
97800
97861
  this.key = lastPressedKey;
97801
97862
  }
97802
97863
 
97803
- const context = this._isGlobal ? window : this;
97804
- if (typeof context.keyReleased === 'function') {
97805
- const executeDefault = context.keyReleased(e);
97806
- if (executeDefault === false) {
97807
- e.preventDefault();
97808
- }
97809
- }
97810
97864
  };
97811
97865
 
97866
+
97812
97867
  /**
97813
97868
  * A function that's called once when keys with printable characters are pressed.
97814
97869
  *
@@ -99020,25 +99075,25 @@ function pointer(p5, fn){
99020
99075
 
99021
99076
  fn._updatePointerCoords = function (e) {
99022
99077
  if (this._curElement !== null) {
99023
- const canvas = this._curElement.elt;
99024
- const sx = canvas.scrollWidth / this.width || 1;
99025
- const sy = canvas.scrollHeight / this.height || 1;
99078
+ const canvas = this._curElement.elt;
99079
+ const sx = canvas.scrollWidth / this.width || 1;
99080
+ const sy = canvas.scrollHeight / this.height || 1;
99026
99081
 
99027
- if (e.pointerType == 'touch') {
99082
+ if (e.pointerType == 'touch') {
99028
99083
  const touches = [];
99029
99084
  for (const touch of this._activePointers.values()) {
99030
- touches.push(getTouchInfo(canvas, sx, sy, touch));
99085
+ touches.push(getTouchInfo(canvas, sx, sy, touch));
99031
99086
  }
99032
99087
  this.touches = touches;
99033
- } else {
99034
- const mousePos = getMouseInfo(canvas, sx, sy, e);
99035
- this.movedX = e.movementX || 0;
99036
- this.movedY = e.movementY || 0;
99037
- this.mouseX = mousePos.x;
99038
- this.mouseY = mousePos.y;
99039
- this.winMouseX = mousePos.winX;
99040
- this.winMouseY = mousePos.winY;
99041
- }
99088
+ }
99089
+
99090
+ const mousePos = getMouseInfo(canvas, sx, sy, e);
99091
+ this.movedX = e.movementX || 0;
99092
+ this.movedY = e.movementY || 0;
99093
+ this.mouseX = mousePos.x;
99094
+ this.mouseY = mousePos.y;
99095
+ this.winMouseX = mousePos.winX;
99096
+ this.winMouseY = mousePos.winY;
99042
99097
 
99043
99098
  if (!this._hasMouseInteracted) {
99044
99099
  this._updateMouseCoords();
@@ -106059,11 +106114,10 @@ function timeDate(p5, fn){
106059
106114
  *
106060
106115
  * If a sketch has a
106061
106116
  * <a href="#/p5/setup">setup()</a> function, then `millis()` begins tracking
106062
- * time before the code in <a href="#/p5/setup">setup()</a> runs. If a
106063
- * sketch includes a <a href="#/p5/preload">preload()</a> function, then
106064
- * `millis()` begins tracking time as soon as the code in
106065
- * <a href="#/p5/preload">preload()</a> starts running.
106066
- *
106117
+ * time before the code in <a href="#/p5/setup">setup()</a> runs. If a
106118
+ * sketch includes asynchronous loading using `async`/`await`, then
106119
+ * `millis()` begins tracking time as soon as the asynchronous code
106120
+ * starts running.
106067
106121
  * @method millis
106068
106122
  * @return {Number} number of milliseconds since starting the sketch.
106069
106123
  *