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.
- package/{src → dist}/accessibility/color_namer.js +48 -3
- package/{src → dist}/accessibility/describe.js +12 -2
- package/{src → dist}/accessibility/gridOutput.js +2 -2
- package/dist/accessibility/index.js +60 -0
- package/{src → dist}/accessibility/outputs.js +23 -2
- package/{src → dist}/accessibility/textOutput.js +2 -2
- package/dist/app.js +120 -0
- package/{src → dist}/color/color_conversion.js +48 -10
- package/{src → dist}/color/color_spaces/hsb.js +3 -1
- package/dist/color/creating_reading.js +3 -0
- package/dist/color/index.js +13 -0
- package/dist/color/p5.Color.culori.js +1 -0
- package/dist/color/p5.Color.js +3 -0
- package/{src → dist}/color/setting.js +9 -6
- package/{src/core/constants.js → dist/constants-tYr0tCl8.js} +284 -132
- package/{src → dist}/core/States.js +3 -1
- package/dist/core/constants.js +1 -0
- package/{src → dist}/core/environment.js +12 -10
- package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
- package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
- package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
- package/dist/core/friendly_errors/index.js +23 -0
- package/dist/core/friendly_errors/param_validator.js +5421 -0
- package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
- package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
- package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
- package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
- package/{src → dist}/core/helpers.js +9 -6
- package/dist/core/init.js +105 -0
- package/dist/core/internationalization.js +302 -0
- package/dist/core/legacy.js +73 -0
- package/dist/core/main.js +44 -0
- package/dist/core/noop.js +3 -0
- package/dist/core/p5.Graphics.js +40 -0
- package/dist/core/p5.Renderer.js +11 -0
- package/dist/core/p5.Renderer2D.js +44 -0
- package/dist/core/reference.js +1 -0
- package/dist/core/rendering.js +40 -0
- package/{src → dist}/core/structure.js +3 -3
- package/{src → dist}/core/transform.js +2 -2
- package/{src/color/creating_reading.js → dist/creating_reading-Cr8L2Jnm.js} +841 -13
- package/{src → dist}/data/index.js +3 -1
- package/{src → dist}/data/local_storage.js +2 -8
- package/{src → dist}/dom/dom.js +19 -13
- package/dist/dom/index.js +18 -0
- package/{src → dist}/dom/p5.Element.js +14 -12
- package/{src → dist}/dom/p5.File.js +4 -4
- package/{src → dist}/dom/p5.MediaElement.js +10 -4
- package/{src → dist}/events/acceleration.js +26 -26
- package/{src → dist}/events/index.js +3 -1
- package/{src → dist}/events/keyboard.js +14 -12
- package/{src → dist}/events/pointer.js +16 -17
- package/dist/image/const.js +9 -0
- package/{src → dist}/image/filterRenderer2D.js +57 -37
- package/{src → dist}/image/filters.js +1 -3
- package/dist/image/image.js +40 -0
- package/dist/image/index.js +51 -0
- package/dist/image/loading_displaying.js +40 -0
- package/dist/image/p5.Image.js +11 -0
- package/{src → dist}/image/pixels.js +5 -3
- package/{src → dist}/io/csv.js +72 -70
- package/dist/io/files.js +40 -0
- package/dist/io/index.js +51 -0
- package/{src → dist}/io/p5.Table.js +6 -6
- package/{src → dist}/io/p5.TableRow.js +5 -6
- package/{src → dist}/io/p5.XML.js +2 -5
- package/{src → dist}/io/utilities.js +1 -1
- package/{src/core/p5.Renderer2D.js → dist/main-CAxvgiOV.js} +738 -57
- package/{src → dist}/math/Matrices/Matrix.js +10 -8
- package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
- package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
- package/{src → dist}/math/calculation.js +2 -2
- package/{src → dist}/math/index.js +6 -3
- package/{src → dist}/math/math.js +3 -3
- package/{src → dist}/math/noise.js +2 -2
- package/{src → dist}/math/p5.Matrix.js +7 -4
- package/{src → dist}/math/p5.Vector.js +6 -6
- package/{src → dist}/math/random.js +2 -2
- package/{src → dist}/math/trigonometry.js +16 -15
- package/{src/image/p5.Image.js → dist/p5.Renderer-Swjl9HQO.js} +393 -22
- package/dist/rendering-B5TRR7aY.js +24960 -0
- package/{src → dist}/shape/2d_primitives.js +18 -17
- package/{src → dist}/shape/attributes.js +18 -17
- package/{src → dist}/shape/curves.js +2 -2
- package/{src → dist}/shape/custom_shapes.js +44 -64
- package/{src → dist}/shape/index.js +10 -2
- package/{src → dist}/shape/vertex.js +2 -3
- package/dist/type/index.js +25 -0
- package/{src → dist}/type/lib/Typr.js +76 -94
- package/{src → dist}/type/p5.Font.js +37 -63
- package/{src → dist}/type/textCore.js +35 -58
- package/{src → dist}/type/unicodeRanges.js +3 -1
- package/{src → dist}/utilities/conversion.js +2 -2
- package/{src → dist}/utilities/index.js +3 -1
- package/{src → dist}/utilities/time_date.js +6 -7
- package/{src → dist}/utilities/utility_functions.js +2 -2
- package/dist/webgl/3d_primitives.js +40 -0
- package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
- package/{src → dist}/webgl/GeometryBuilder.js +12 -8
- package/{src → dist}/webgl/ShaderGenerator.js +79 -82
- package/{src → dist}/webgl/ShapeBuilder.js +26 -23
- package/dist/webgl/index.js +76 -0
- package/{src → dist}/webgl/interaction.js +7 -6
- package/dist/webgl/light.js +40 -0
- package/{src → dist}/webgl/loading.js +45 -12
- package/dist/webgl/material.js +40 -0
- package/dist/webgl/p5.Camera.js +40 -0
- package/{src → dist}/webgl/p5.DataArray.js +3 -5
- package/dist/webgl/p5.Framebuffer.js +40 -0
- package/{src → dist}/webgl/p5.Geometry.js +12 -15
- package/{src → dist}/webgl/p5.Quat.js +5 -4
- package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
- package/dist/webgl/p5.RendererGL.js +40 -0
- package/dist/webgl/p5.Shader.js +40 -0
- package/dist/webgl/p5.Texture.js +40 -0
- package/{src → dist}/webgl/text.js +78 -38
- package/lib/p5.esm.js +296 -194
- package/lib/p5.js +296 -194
- package/lib/p5.min.js +1 -1
- package/package.json +17 -17
- package/translations/dev.js +6 -6
- package/translations/index.js +1 -1
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5996 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +499 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5542 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6663 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +481 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
- package/src/README.md +0 -27
- package/src/accessibility/index.js +0 -13
- package/src/app.js +0 -61
- package/src/color/index.js +0 -9
- package/src/color/p5.Color.culori.js +0 -66
- package/src/color/p5.Color.js +0 -851
- package/src/core/README.md +0 -91
- package/src/core/friendly_errors/index.js +0 -13
- package/src/core/friendly_errors/param_validator.js +0 -561
- package/src/core/init.js +0 -58
- package/src/core/internationalization.js +0 -195
- package/src/core/legacy.js +0 -29
- package/src/core/main.js +0 -689
- package/src/core/noop.js +0 -1
- package/src/core/p5.Graphics.js +0 -696
- package/src/core/p5.Renderer.js +0 -408
- package/src/core/reference.js +0 -2060
- package/src/core/rendering.js +0 -697
- package/src/dom/index.js +0 -11
- package/src/image/const.js +0 -6
- package/src/image/image.js +0 -731
- package/src/image/index.js +0 -15
- package/src/image/loading_displaying.js +0 -1431
- package/src/io/files.js +0 -2210
- package/src/io/index.js +0 -11
- package/src/math/README.md +0 -40
- package/src/type/index.js +0 -9
- package/src/webgl/3d_primitives.js +0 -2741
- package/src/webgl/index.js +0 -37
- package/src/webgl/light.js +0 -1851
- package/src/webgl/material.js +0 -3854
- package/src/webgl/p5.Camera.js +0 -4010
- package/src/webgl/p5.Framebuffer.js +0 -1865
- package/src/webgl/p5.RendererGL.js +0 -2867
- package/src/webgl/p5.Shader.js +0 -1505
- package/src/webgl/p5.Texture.js +0 -541
- package/src/webgl/shaders/basic.frag +0 -6
- package/src/webgl/shaders/filters/base.frag +0 -22
- package/src/webgl/shaders/filters/base.vert +0 -19
- package/src/webgl/shaders/filters/blur.frag +0 -60
- package/src/webgl/shaders/filters/default.vert +0 -18
- package/src/webgl/shaders/filters/dilate.frag +0 -39
- package/src/webgl/shaders/filters/erode.frag +0 -39
- package/src/webgl/shaders/filters/gray.frag +0 -16
- package/src/webgl/shaders/filters/invert.frag +0 -15
- package/src/webgl/shaders/filters/opaque.frag +0 -12
- package/src/webgl/shaders/filters/posterize.frag +0 -29
- package/src/webgl/shaders/filters/threshold.frag +0 -23
- package/src/webgl/shaders/font.frag +0 -216
- package/src/webgl/shaders/font.vert +0 -44
- package/src/webgl/shaders/imageLight.vert +0 -33
- package/src/webgl/shaders/imageLightDiffused.frag +0 -82
- package/src/webgl/shaders/imageLightSpecular.frag +0 -134
- package/src/webgl/shaders/light.vert +0 -37
- package/src/webgl/shaders/light_texture.frag +0 -26
- package/src/webgl/shaders/lighting.glsl +0 -227
- package/src/webgl/shaders/line.frag +0 -74
- package/src/webgl/shaders/line.vert +0 -294
- package/src/webgl/shaders/normal.frag +0 -6
- package/src/webgl/shaders/normal.vert +0 -72
- package/src/webgl/shaders/phong.frag +0 -84
- package/src/webgl/shaders/phong.vert +0 -87
- package/src/webgl/shaders/point.frag +0 -29
- package/src/webgl/shaders/point.vert +0 -19
- package/src/webgl/shaders/sphereMapping.frag +0 -26
- package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
|
@@ -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 };
|
package/{src → dist}/dom/dom.js
RENAMED
|
@@ -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(
|
|
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
|
-
* '
|
|
597
|
-
* '
|
|
602
|
+
* '/assets/cat.jpg',
|
|
603
|
+
* 'image of a cat'
|
|
598
604
|
* );
|
|
599
|
-
* img.position(0,
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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 =
|
|
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(
|
|
148
|
+
* createCanvas(200, 200, WEBGL); // Create 3D canvas
|
|
147
149
|
* }
|
|
148
150
|
*
|
|
149
151
|
* function draw() {
|
|
150
|
-
* background(
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* //
|
|
154
|
-
*
|
|
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(
|
|
181
|
+
* createCanvas(200, 200, WEBGL); // Create 3D canvas
|
|
180
182
|
* }
|
|
181
183
|
*
|
|
182
184
|
* function draw() {
|
|
183
|
-
* background(
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
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(
|
|
215
|
+
* createCanvas(200, 200, WEBGL); // Create 3D canvas
|
|
214
216
|
* }
|
|
215
217
|
*
|
|
216
218
|
* function draw() {
|
|
217
|
-
* background(
|
|
218
|
-
* rotateZ(radians(rotationZ));
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
916
|
-
|
|
917
|
-
|
|
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
|
-
|
|
918
|
+
if (e.pointerType == 'touch') {
|
|
920
919
|
const touches = [];
|
|
921
920
|
for (const touch of this._activePointers.values()) {
|
|
922
|
-
|
|
921
|
+
touches.push(getTouchInfo(canvas, sx, sy, touch));
|
|
923
922
|
}
|
|
924
923
|
this.touches = touches;
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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 };
|
|
@@ -1,23 +1,43 @@
|
|
|
1
|
-
import { Shader } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
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 =
|
|
55
|
+
let webglVersion = WEBGL2;
|
|
36
56
|
this.gl = this.canvas.getContext('webgl2');
|
|
37
57
|
if (!this.gl) {
|
|
38
|
-
webglVersion =
|
|
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
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
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 ===
|
|
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',
|
|
240
|
-
this.pInst.states.setValue('imageMode',
|
|
241
|
-
this.pInst.blendMode(
|
|
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 ===
|
|
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(
|
|
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
|
|
330
|
+
export { FilterRenderer2D as default };
|