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.
- package/{src → dist}/accessibility/color_namer.js +48 -3
- package/{src → dist}/accessibility/describe.js +2 -2
- package/{src → dist}/accessibility/gridOutput.js +2 -2
- package/dist/accessibility/index.js +60 -0
- package/{src → dist}/accessibility/outputs.js +2 -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-C-g_eAdC.js} +266 -130
- package/{src → dist}/core/States.js +3 -1
- package/dist/core/constants.js +1 -0
- package/{src → dist}/core/environment.js +7 -6
- 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 +5455 -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-D4AAKRbx.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 +11 -5
- 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 +2 -2
- package/{src → dist}/events/index.js +3 -1
- package/{src → dist}/events/keyboard.js +14 -11
- 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 +4 -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 +3 -4
- 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-s72KWcUy.js} +735 -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 +2 -2
- 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-CwAYZOC2.js} +390 -19
- package/dist/rendering--aAe5aq3.js +24925 -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 -61
- package/{src → dist}/type/textCore.js +34 -57
- 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 +51 -9
- package/lib/p5.esm.js +102 -48
- package/lib/p5.js +102 -48
- package/lib/p5.min.js +1 -1
- package/package.json +17 -16
- package/translations/dev.js +6 -6
- package/translations/index.js +1 -1
- 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-D4AAKRbx.js';
|
|
5
|
+
import 'colorjs.io/fn';
|
|
6
|
+
import '../color/color_spaces/hsb.js';
|
|
7
|
+
import '../constants-C-g_eAdC.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
|
/**
|
|
@@ -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-D4AAKRbx.js';
|
|
6
|
+
import 'colorjs.io/fn';
|
|
7
|
+
import '../color/color_spaces/hsb.js';
|
|
8
|
+
import '../constants-C-g_eAdC.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-D4AAKRbx.js';
|
|
3
|
+
import { w as AUTO } from '../constants-C-g_eAdC.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-D4AAKRbx.js';
|
|
5
|
+
import 'colorjs.io/fn';
|
|
6
|
+
import '../color/color_spaces/hsb.js';
|
|
7
|
+
import '../constants-C-g_eAdC.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 };
|
|
@@ -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,15 +661,9 @@ 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
|
|
|
666
|
+
|
|
664
667
|
/**
|
|
665
668
|
* A function that's called once when keys with printable characters are pressed.
|
|
666
669
|
*
|
|
@@ -935,7 +938,7 @@ function keyboard(p5, fn){
|
|
|
935
938
|
} else {
|
|
936
939
|
return this._downKeys[input] || this._downKeyCodes[input] || false;
|
|
937
940
|
}
|
|
938
|
-
}
|
|
941
|
+
};
|
|
939
942
|
/**
|
|
940
943
|
* The _areDownKeys function returns a boolean true if any keys pressed
|
|
941
944
|
* and a false if no keys are currently pressed.
|
|
@@ -955,8 +958,8 @@ function keyboard(p5, fn){
|
|
|
955
958
|
};
|
|
956
959
|
}
|
|
957
960
|
|
|
958
|
-
export default keyboard;
|
|
959
|
-
|
|
960
961
|
if(typeof p5 !== 'undefined'){
|
|
961
962
|
keyboard(p5, p5.prototype);
|
|
962
963
|
}
|
|
964
|
+
|
|
965
|
+
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--aAe5aq3.js';
|
|
2
|
+
import { I as Image } from '../p5.Renderer-CwAYZOC2.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-C-g_eAdC.js';
|
|
4
|
+
import { filterParamDefaults } from './const.js';
|
|
5
|
+
import '../creating_reading-D4AAKRbx.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 };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import 'omggif';
|
|
2
|
+
import '../dom/p5.Element.js';
|
|
3
|
+
export { i as default } from '../rendering--aAe5aq3.js';
|
|
4
|
+
import '../dom/p5.File.js';
|
|
5
|
+
import '../io/p5.XML.js';
|
|
6
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
7
|
+
import 'colorjs.io/fn';
|
|
8
|
+
import '../color/color_spaces/hsb.js';
|
|
9
|
+
import '../constants-C-g_eAdC.js';
|
|
10
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
11
|
+
import './filters.js';
|
|
12
|
+
import '../math/p5.Vector.js';
|
|
13
|
+
import '../shape/custom_shapes.js';
|
|
14
|
+
import '../core/States.js';
|
|
15
|
+
import '../io/utilities.js';
|
|
16
|
+
import 'file-saver';
|
|
17
|
+
import '../dom/p5.MediaElement.js';
|
|
18
|
+
import '../shape/2d_primitives.js';
|
|
19
|
+
import '../core/helpers.js';
|
|
20
|
+
import '../shape/attributes.js';
|
|
21
|
+
import '../shape/curves.js';
|
|
22
|
+
import '../shape/vertex.js';
|
|
23
|
+
import '../color/setting.js';
|
|
24
|
+
import '../io/csv.js';
|
|
25
|
+
import 'gifenc';
|
|
26
|
+
import './pixels.js';
|
|
27
|
+
import '../core/transform.js';
|
|
28
|
+
import '../webgl/GeometryBuilder.js';
|
|
29
|
+
import '../math/p5.Matrix.js';
|
|
30
|
+
import '../math/Matrices/Matrix.js';
|
|
31
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
32
|
+
import '../webgl/p5.Geometry.js';
|
|
33
|
+
import '../webgl/p5.DataArray.js';
|
|
34
|
+
import '../webgl/p5.Quat.js';
|
|
35
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
36
|
+
import '../webgl/ShapeBuilder.js';
|
|
37
|
+
import 'libtess';
|
|
38
|
+
import '../webgl/GeometryBufferCache.js';
|
|
39
|
+
import './const.js';
|
|
40
|
+
import '../math/trigonometry.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { i as image$1, b as loadingDisplaying, s as shader, t as texture } from '../rendering--aAe5aq3.js';
|
|
2
|
+
import { i as image$2 } from '../p5.Renderer-CwAYZOC2.js';
|
|
3
|
+
import pixels from './pixels.js';
|
|
4
|
+
import '../constants-C-g_eAdC.js';
|
|
5
|
+
import '../creating_reading-D4AAKRbx.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 '../core/transform.js';
|
|
24
|
+
import '../webgl/GeometryBuilder.js';
|
|
25
|
+
import '../math/p5.Matrix.js';
|
|
26
|
+
import '../math/Matrices/Matrix.js';
|
|
27
|
+
import '../math/p5.Vector.js';
|
|
28
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
29
|
+
import '../webgl/p5.Geometry.js';
|
|
30
|
+
import '../webgl/p5.DataArray.js';
|
|
31
|
+
import '../webgl/p5.Quat.js';
|
|
32
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
33
|
+
import '../webgl/ShapeBuilder.js';
|
|
34
|
+
import 'libtess';
|
|
35
|
+
import '../webgl/GeometryBufferCache.js';
|
|
36
|
+
import './const.js';
|
|
37
|
+
import '../shape/custom_shapes.js';
|
|
38
|
+
import '../math/trigonometry.js';
|
|
39
|
+
import './filters.js';
|
|
40
|
+
import '../core/States.js';
|
|
41
|
+
|
|
42
|
+
function image(p5){
|
|
43
|
+
p5.registerAddon(image$1);
|
|
44
|
+
p5.registerAddon(loadingDisplaying);
|
|
45
|
+
p5.registerAddon(image$2);
|
|
46
|
+
p5.registerAddon(pixels);
|
|
47
|
+
p5.registerAddon(shader);
|
|
48
|
+
p5.registerAddon(texture);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { image as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../core/helpers.js';
|
|
2
|
+
import '../constants-C-g_eAdC.js';
|
|
3
|
+
export { b as default } from '../rendering--aAe5aq3.js';
|
|
4
|
+
import 'omggif';
|
|
5
|
+
import 'gifenc';
|
|
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 './filters.js';
|
|
14
|
+
import '../math/p5.Vector.js';
|
|
15
|
+
import '../shape/custom_shapes.js';
|
|
16
|
+
import '../core/States.js';
|
|
17
|
+
import '../io/utilities.js';
|
|
18
|
+
import 'file-saver';
|
|
19
|
+
import '../dom/p5.MediaElement.js';
|
|
20
|
+
import '../shape/2d_primitives.js';
|
|
21
|
+
import '../shape/attributes.js';
|
|
22
|
+
import '../shape/curves.js';
|
|
23
|
+
import '../shape/vertex.js';
|
|
24
|
+
import '../color/setting.js';
|
|
25
|
+
import '../io/csv.js';
|
|
26
|
+
import './pixels.js';
|
|
27
|
+
import '../core/transform.js';
|
|
28
|
+
import '../webgl/GeometryBuilder.js';
|
|
29
|
+
import '../math/p5.Matrix.js';
|
|
30
|
+
import '../math/Matrices/Matrix.js';
|
|
31
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
32
|
+
import '../webgl/p5.Geometry.js';
|
|
33
|
+
import '../webgl/p5.DataArray.js';
|
|
34
|
+
import '../webgl/p5.Quat.js';
|
|
35
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
36
|
+
import '../webgl/ShapeBuilder.js';
|
|
37
|
+
import 'libtess';
|
|
38
|
+
import '../webgl/GeometryBufferCache.js';
|
|
39
|
+
import './const.js';
|
|
40
|
+
import '../math/trigonometry.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './filters.js';
|
|
2
|
+
export { I as Image, i as default } from '../p5.Renderer-CwAYZOC2.js';
|
|
3
|
+
import '../io/utilities.js';
|
|
4
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
5
|
+
import 'colorjs.io/fn';
|
|
6
|
+
import '../color/color_spaces/hsb.js';
|
|
7
|
+
import '../constants-C-g_eAdC.js';
|
|
8
|
+
import '../math/p5.Vector.js';
|
|
9
|
+
import '../shape/custom_shapes.js';
|
|
10
|
+
import '../core/States.js';
|
|
11
|
+
import 'file-saver';
|