p5 2.2.3-rc.0 → 2.2.3
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/README.md +4 -5
- package/dist/accessibility/color_namer.js +5 -5
- package/dist/accessibility/index.js +5 -5
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-D3ryGa0m.js → constants-BdTiYOQI.js} +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +1 -1
- package/dist/core/filterShaders.js +1 -1
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/file_errors.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +1 -1
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +3 -3
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/p5.Renderer3D.js +3 -3
- package/dist/core/rendering.js +3 -3
- package/dist/data/local_storage.js +13 -9
- package/dist/dom/dom.js +30 -29
- package/dist/dom/index.js +1 -1
- package/dist/dom/p5.Element.js +3 -3
- package/dist/dom/p5.MediaElement.js +4 -5
- package/dist/events/pointer.js +1 -1
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +3 -3
- package/dist/image/index.js +3 -3
- package/dist/image/loading_displaying.js +3 -3
- package/dist/image/p5.Image.js +2 -2
- package/dist/io/files.js +3 -3
- package/dist/io/index.js +3 -3
- package/dist/io/p5.XML.js +8 -8
- package/dist/{ir_builders-DMfaOLIL.js → ir_builders-Cd6rU9Vm.js} +0 -6
- package/dist/{main-CGwYa9-f.js → main-H_nu4eDs.js} +3 -3
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-C0e0XesC.js → p5.Renderer-BmD2P6Wv.js} +4 -3
- package/dist/{rendering-4Z2qdE_W.js → rendering-CC8JNTwG.js} +21 -58
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +1 -1
- package/dist/shape/index.js +1 -1
- package/dist/strands/ir_builders.js +1 -1
- package/dist/strands/p5.strands.js +10 -34
- package/dist/strands/strands_api.js +1 -2
- package/dist/strands/strands_codegen.js +0 -12
- package/dist/strands/strands_conditionals.js +1 -1
- package/dist/strands/strands_for.js +1 -1
- package/dist/strands/strands_node.js +1 -1
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +2 -2
- package/dist/type/textCore.js +2 -2
- package/dist/webgl/3d_primitives.js +3 -3
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +3 -3
- package/dist/webgl/loading.js +4 -6
- package/dist/webgl/material.js +3 -3
- package/dist/webgl/p5.Camera.js +3 -3
- package/dist/webgl/p5.Framebuffer.js +3 -3
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Shader.js +14 -6
- package/dist/webgl/p5.Texture.js +3 -3
- package/dist/webgl/strands_glslBackend.js +1 -1
- package/dist/webgl/text.js +3 -3
- package/dist/webgl/utils.js +3 -3
- package/dist/webgpu/index.js +2 -2
- package/dist/webgpu/p5.RendererWebGPU.js +2 -2
- package/dist/webgpu/strands_wgslBackend.js +1 -1
- package/lib/p5.esm.js +104 -173
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +104 -173
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +1 -7
- package/lib/p5.webgpu.js +1 -7
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +1 -1
- package/types/global.d.ts +1170 -1210
- package/types/p5.d.ts +645 -658
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as CORNER, t as CORNERS, v as CENTER, aB as COVER, aC as CONTAIN, a9 as RIGHT, aw as BOTTOM, B as BLEND, aD as FILL, ad as IMAGE, C as CLAMP, w as ROUND, Y as LINES, X as POINTS, c as TRIANGLES, ab as BLUR, D as DARKEST, L as LIGHTEST, A as ADD, S as SUBTRACT, a as SCREEN, E as EXCLUSION, R as REPLACE, M as MULTIPLY, b as REMOVE, as as BURN, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, d as UNSIGNED_INT, U as UNSIGNED_BYTE, av as LEFT, ax as BASELINE, ay as TOP, aE as SIMPLE, aF as FULL, q as TWO_PI, Q as OPEN, a2 as NORMAL, V as CLOSE, at as PIE, au as CHORD, h as TEXTURE, P as P2D, g as LINEAR, aa as WEBGL2, N as NEAREST, aG as LINEAR_MIPMAP, f as REPEAT, e as MIRROR, F as FLOAT, ac as WEBGL, H as HALF_FLOAT } from './constants-
|
|
1
|
+
import { p as CORNER, t as CORNERS, v as CENTER, aB as COVER, aC as CONTAIN, a9 as RIGHT, aw as BOTTOM, B as BLEND, aD as FILL, ad as IMAGE, C as CLAMP, w as ROUND, Y as LINES, X as POINTS, c as TRIANGLES, ab as BLUR, D as DARKEST, L as LIGHTEST, A as ADD, S as SUBTRACT, a as SCREEN, E as EXCLUSION, R as REPLACE, M as MULTIPLY, b as REMOVE, as as BURN, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, d as UNSIGNED_INT, U as UNSIGNED_BYTE, av as LEFT, ax as BASELINE, ay as TOP, aE as SIMPLE, aF as FULL, q as TWO_PI, Q as OPEN, a2 as NORMAL, V as CLOSE, at as PIE, au as CHORD, h as TEXTURE, P as P2D, g as LINEAR, aa as WEBGL2, N as NEAREST, aG as LINEAR_MIPMAP, f as REPEAT, e as MIRROR, F as FLOAT, ac as WEBGL, H as HALF_FLOAT } from './constants-BdTiYOQI.js';
|
|
2
2
|
import { C as Color, c as creatingReading, h as RGBA, R as RGB } from './creating_reading-C7hu6sg1.js';
|
|
3
3
|
import { Element } from './dom/p5.Element.js';
|
|
4
|
-
import { R as Renderer, I as Image } from './p5.Renderer-
|
|
4
|
+
import { R as Renderer, I as Image } from './p5.Renderer-BmD2P6Wv.js';
|
|
5
5
|
import { MediaElement } from './dom/p5.MediaElement.js';
|
|
6
6
|
import primitives from './shape/2d_primitives.js';
|
|
7
7
|
import attributes from './shape/attributes.js';
|
|
@@ -1277,7 +1277,7 @@ function files(p5, fn){
|
|
|
1277
1277
|
* (<a href="https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction" target="_blank">XML</a>)
|
|
1278
1278
|
* is a standard format for sending data between applications. Like HTML, the
|
|
1279
1279
|
* XML format is based on tags and attributes, as in
|
|
1280
|
-
*
|
|
1280
|
+
* `<time units="s">1234</time>`.
|
|
1281
1281
|
*
|
|
1282
1282
|
* The first parameter, `path`, is always a string with the path to the file.
|
|
1283
1283
|
* Paths to local files should be relative, as in
|
|
@@ -10176,11 +10176,6 @@ function primitives3D(p5, fn){
|
|
|
10176
10176
|
* The parameter, `callback`, is a function with the drawing instructions for
|
|
10177
10177
|
* the new <a href="#/p5.Geometry">p5.Geometry</a> object. It will be called
|
|
10178
10178
|
* once to create the new 3D shape.
|
|
10179
|
-
*
|
|
10180
|
-
* See <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
10181
|
-
* <a href="#/p5/endGeometry">endGeometry()</a> for another way to build 3D
|
|
10182
|
-
* shapes.
|
|
10183
|
-
*
|
|
10184
10179
|
* Note: `buildGeometry()` can only be used in WebGL mode.
|
|
10185
10180
|
*
|
|
10186
10181
|
* @method buildGeometry
|
|
@@ -10384,12 +10379,8 @@ function primitives3D(p5, fn){
|
|
|
10384
10379
|
* <a href="#/p5.Geometry">p5.Geometry</a> objects can contain lots of data
|
|
10385
10380
|
* about their vertices, surface normals, colors, and so on. Complex 3D shapes
|
|
10386
10381
|
* can use lots of memory which is a limited resource in many GPUs. Calling
|
|
10387
|
-
* `freeGeometry()` can improve performance by freeing a
|
|
10388
|
-
* <a href="#/p5.Geometry">p5.Geometry</a> object’s resources from GPU memory.
|
|
10389
10382
|
* `freeGeometry()` works with <a href="#/p5.Geometry">p5.Geometry</a> objects
|
|
10390
|
-
* created with <a href="#/p5/
|
|
10391
|
-
* <a href="#/p5/endGeometry">endGeometry()</a>,
|
|
10392
|
-
* <a href="#/p5/buildGeometry">buildGeometry()</a>, and
|
|
10383
|
+
* created with <a href="#/p5/buildGeometry">buildGeometry()</a> and
|
|
10393
10384
|
* <a href="#/p5/loadModel">loadModel()</a>.
|
|
10394
10385
|
*
|
|
10395
10386
|
* The parameter, `geometry`, is the <a href="#/p5.Geometry">p5.Geometry</a>
|
|
@@ -10405,24 +10396,6 @@ function primitives3D(p5, fn){
|
|
|
10405
10396
|
* @param {p5.Geometry} geometry 3D shape whose resources should be freed.
|
|
10406
10397
|
*
|
|
10407
10398
|
* @example
|
|
10408
|
-
* function setup() {
|
|
10409
|
-
* createCanvas(100, 100, WEBGL);
|
|
10410
|
-
*
|
|
10411
|
-
* background(200);
|
|
10412
|
-
*
|
|
10413
|
-
* // Create a p5.Geometry object.
|
|
10414
|
-
* beginGeometry();
|
|
10415
|
-
* cone();
|
|
10416
|
-
* let shape = endGeometry();
|
|
10417
|
-
*
|
|
10418
|
-
* // Draw the shape.
|
|
10419
|
-
* model(shape);
|
|
10420
|
-
*
|
|
10421
|
-
* // Free the shape's resources.
|
|
10422
|
-
* freeGeometry(shape);
|
|
10423
|
-
* }
|
|
10424
|
-
*
|
|
10425
|
-
* @example
|
|
10426
10399
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10427
10400
|
*
|
|
10428
10401
|
* let button;
|
|
@@ -14859,7 +14832,7 @@ function material(p5, fn) {
|
|
|
14859
14832
|
* // Make a version of the shader with a hook overridden
|
|
14860
14833
|
* modifiedShader = myShader.modify(() => {
|
|
14861
14834
|
* // Create new uniforms and override the getColor hook
|
|
14862
|
-
* let t =
|
|
14835
|
+
* let t = millis() / 1000;
|
|
14863
14836
|
* getColor(() => {
|
|
14864
14837
|
* return [0, 0.5 + 0.5 * sin(t), 1, 1];
|
|
14865
14838
|
* });
|
|
@@ -15105,7 +15078,7 @@ function material(p5, fn) {
|
|
|
15105
15078
|
* }
|
|
15106
15079
|
* ```
|
|
15107
15080
|
*
|
|
15108
|
-
* You can also animate your filters over time
|
|
15081
|
+
* You can also animate your filters over time using the `millis()` function.
|
|
15109
15082
|
*
|
|
15110
15083
|
* ```js example
|
|
15111
15084
|
* let myFilter;
|
|
@@ -15116,7 +15089,7 @@ function material(p5, fn) {
|
|
|
15116
15089
|
* }
|
|
15117
15090
|
*
|
|
15118
15091
|
* function gradient() {
|
|
15119
|
-
* let time =
|
|
15092
|
+
* let time = millis();
|
|
15120
15093
|
* filterColor.begin();
|
|
15121
15094
|
* filterColor.set(mix(
|
|
15122
15095
|
* [1, 0, 0, 1], // Red
|
|
@@ -15127,12 +15100,11 @@ function material(p5, fn) {
|
|
|
15127
15100
|
* }
|
|
15128
15101
|
*
|
|
15129
15102
|
* function draw() {
|
|
15130
|
-
* myFilter.setUniform('time', millis());
|
|
15131
15103
|
* filter(myFilter);
|
|
15132
15104
|
* }
|
|
15133
15105
|
* ```
|
|
15134
15106
|
*
|
|
15135
|
-
* We can use the `noise()` function built into strands to generate a color for each pixel. (Again no need here for underlying content for the filter to operate on.) Again we'll animate by
|
|
15107
|
+
* We can use the `noise()` function built into strands to generate a color for each pixel. (Again no need here for underlying content for the filter to operate on.) Again we'll animate by using the millis() function to get an up-to-date time value.
|
|
15136
15108
|
*
|
|
15137
15109
|
* ```js example
|
|
15138
15110
|
* let myFilter;
|
|
@@ -15144,7 +15116,7 @@ function material(p5, fn) {
|
|
|
15144
15116
|
* }
|
|
15145
15117
|
*
|
|
15146
15118
|
* function noiseShaderCallback() {
|
|
15147
|
-
* let time =
|
|
15119
|
+
* let time = millis();
|
|
15148
15120
|
* filterColor.begin();
|
|
15149
15121
|
* let coord = filterColor.texCoord;
|
|
15150
15122
|
*
|
|
@@ -15161,7 +15133,6 @@ function material(p5, fn) {
|
|
|
15161
15133
|
* }
|
|
15162
15134
|
*
|
|
15163
15135
|
* function draw() {
|
|
15164
|
-
* myFilter.setUniform("time", millis());
|
|
15165
15136
|
* filter(myFilter);
|
|
15166
15137
|
* }
|
|
15167
15138
|
* ```
|
|
@@ -15375,7 +15346,7 @@ function material(p5, fn) {
|
|
|
15375
15346
|
* }
|
|
15376
15347
|
*
|
|
15377
15348
|
* function material() {
|
|
15378
|
-
* let time =
|
|
15349
|
+
* let time = millis() / 1000;
|
|
15379
15350
|
* finalColor.begin();
|
|
15380
15351
|
* let r = 0.2 + 0.5 * abs(sin(time + 0));
|
|
15381
15352
|
* let g = 0.2 + 0.5 * abs(sin(time + 1));
|
|
@@ -15386,7 +15357,6 @@ function material(p5, fn) {
|
|
|
15386
15357
|
*
|
|
15387
15358
|
* function draw() {
|
|
15388
15359
|
* background(245, 245, 220);
|
|
15389
|
-
* myShader.setUniform('time', millis() / 1000);
|
|
15390
15360
|
* shader(myShader);
|
|
15391
15361
|
*
|
|
15392
15362
|
* rectMode(CENTER);
|
|
@@ -15862,7 +15832,7 @@ function material(p5, fn) {
|
|
|
15862
15832
|
* }
|
|
15863
15833
|
*
|
|
15864
15834
|
* function material() {
|
|
15865
|
-
* let time =
|
|
15835
|
+
* let time = millis();
|
|
15866
15836
|
* worldInputs.begin();
|
|
15867
15837
|
* worldInputs.position.y +=
|
|
15868
15838
|
* 20 * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -15872,7 +15842,6 @@ function material(p5, fn) {
|
|
|
15872
15842
|
* function draw() {
|
|
15873
15843
|
* background(255);
|
|
15874
15844
|
* shader(myShader);
|
|
15875
|
-
* myShader.setUniform('time', millis());
|
|
15876
15845
|
* lights();
|
|
15877
15846
|
* noStroke();
|
|
15878
15847
|
* fill('red');
|
|
@@ -16041,7 +16010,6 @@ function material(p5, fn) {
|
|
|
16041
16010
|
* function draw() {
|
|
16042
16011
|
* background(255);
|
|
16043
16012
|
* shader(myShader);
|
|
16044
|
-
* myShader.setUniform('time', millis());
|
|
16045
16013
|
* lights();
|
|
16046
16014
|
* noStroke();
|
|
16047
16015
|
* fill('red');
|
|
@@ -16055,7 +16023,7 @@ function material(p5, fn) {
|
|
|
16055
16023
|
*
|
|
16056
16024
|
* ```js
|
|
16057
16025
|
* // myMaterial.js
|
|
16058
|
-
* let time =
|
|
16026
|
+
* let time = millis();
|
|
16059
16027
|
* worldInputs.begin();
|
|
16060
16028
|
* worldInputs.position.y +=
|
|
16061
16029
|
* 20 * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -16164,7 +16132,7 @@ function material(p5, fn) {
|
|
|
16164
16132
|
* }
|
|
16165
16133
|
*
|
|
16166
16134
|
* function material() {
|
|
16167
|
-
* let time =
|
|
16135
|
+
* let time = millis();
|
|
16168
16136
|
* worldInputs.begin();
|
|
16169
16137
|
* worldInputs.position.y +=
|
|
16170
16138
|
* 20. * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -16174,7 +16142,6 @@ function material(p5, fn) {
|
|
|
16174
16142
|
* function draw() {
|
|
16175
16143
|
* background(255);
|
|
16176
16144
|
* shader(myShader);
|
|
16177
|
-
* myShader.setUniform('time', millis());
|
|
16178
16145
|
* noStroke();
|
|
16179
16146
|
* sphere(50);
|
|
16180
16147
|
* }
|
|
@@ -16260,7 +16227,6 @@ function material(p5, fn) {
|
|
|
16260
16227
|
* function draw() {
|
|
16261
16228
|
* background(255);
|
|
16262
16229
|
* shader(myShader);
|
|
16263
|
-
* myShader.setUniform('time', millis());
|
|
16264
16230
|
* lights();
|
|
16265
16231
|
* noStroke();
|
|
16266
16232
|
* fill('red');
|
|
@@ -16274,7 +16240,7 @@ function material(p5, fn) {
|
|
|
16274
16240
|
*
|
|
16275
16241
|
* ```js
|
|
16276
16242
|
* // myMaterial.js
|
|
16277
|
-
* let time =
|
|
16243
|
+
* let time = millis();
|
|
16278
16244
|
* worldInputs.begin();
|
|
16279
16245
|
* worldInputs.position.y +=
|
|
16280
16246
|
* 20 * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -16367,7 +16333,7 @@ function material(p5, fn) {
|
|
|
16367
16333
|
* }
|
|
16368
16334
|
*
|
|
16369
16335
|
* function material() {
|
|
16370
|
-
* let time =
|
|
16336
|
+
* let time = millis();
|
|
16371
16337
|
* worldInputs.begin();
|
|
16372
16338
|
* worldInputs.position.y +=
|
|
16373
16339
|
* 20 * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -16377,7 +16343,6 @@ function material(p5, fn) {
|
|
|
16377
16343
|
* function draw() {
|
|
16378
16344
|
* background(255);
|
|
16379
16345
|
* shader(myShader);
|
|
16380
|
-
* myShader.setUniform('time', millis());
|
|
16381
16346
|
* noStroke();
|
|
16382
16347
|
* fill('red');
|
|
16383
16348
|
* circle(0, 0, 50);
|
|
@@ -16426,7 +16391,6 @@ function material(p5, fn) {
|
|
|
16426
16391
|
* function draw() {
|
|
16427
16392
|
* background(255);
|
|
16428
16393
|
* shader(myShader);
|
|
16429
|
-
* myShader.setUniform('time', millis());
|
|
16430
16394
|
* lights();
|
|
16431
16395
|
* noStroke();
|
|
16432
16396
|
* fill('red');
|
|
@@ -16440,7 +16404,7 @@ function material(p5, fn) {
|
|
|
16440
16404
|
*
|
|
16441
16405
|
* ```js
|
|
16442
16406
|
* // myMaterial.js
|
|
16443
|
-
* let time =
|
|
16407
|
+
* let time = millis();
|
|
16444
16408
|
* worldInputs.begin();
|
|
16445
16409
|
* worldInputs.position.y +=
|
|
16446
16410
|
* 20 * sin(time * 0.001 + worldInputs.position.x * 0.05);
|
|
@@ -16612,7 +16576,7 @@ function material(p5, fn) {
|
|
|
16612
16576
|
* }
|
|
16613
16577
|
*
|
|
16614
16578
|
* function material() {
|
|
16615
|
-
* let time =
|
|
16579
|
+
* let time = millis();
|
|
16616
16580
|
* worldInputs.begin();
|
|
16617
16581
|
* // Add a somewhat random offset to the weight
|
|
16618
16582
|
* // that varies based on position and time
|
|
@@ -16628,7 +16592,6 @@ function material(p5, fn) {
|
|
|
16628
16592
|
* function draw() {
|
|
16629
16593
|
* background(255);
|
|
16630
16594
|
* strokeShader(myShader);
|
|
16631
|
-
* myShader.setUniform('time', millis());
|
|
16632
16595
|
* strokeWeight(10);
|
|
16633
16596
|
* beginShape();
|
|
16634
16597
|
* for (let i = 0; i <= 50; i++) {
|
|
@@ -18494,7 +18457,7 @@ class Graphics {
|
|
|
18494
18457
|
* Removes the graphics buffer from the web page.
|
|
18495
18458
|
*
|
|
18496
18459
|
* Calling `myGraphics.remove()` removes the graphics buffer's
|
|
18497
|
-
*
|
|
18460
|
+
* `<canvas>` element from the web page. The graphics buffer also uses
|
|
18498
18461
|
* a bit of memory on the CPU that can be freed like so:
|
|
18499
18462
|
*
|
|
18500
18463
|
* ```js
|
|
@@ -18850,7 +18813,7 @@ function graphics(p5, fn){
|
|
|
18850
18813
|
* @param {Number} h height height of the graphics buffer in pixels.
|
|
18851
18814
|
* @param {(P2D|WEBGL|P2DHDR)} renderer the renderer to use, either P2D or WEBGL.
|
|
18852
18815
|
* @param {p5} [pInst] sketch instance.
|
|
18853
|
-
* @param {HTMLCanvasElement} [canvas] existing
|
|
18816
|
+
* @param {HTMLCanvasElement} [canvas] existing `<canvas>` element to use.
|
|
18854
18817
|
*
|
|
18855
18818
|
* @example
|
|
18856
18819
|
* let pg;
|
|
@@ -21829,9 +21792,9 @@ function rendering(p5, fn){
|
|
|
21829
21792
|
|
|
21830
21793
|
/**
|
|
21831
21794
|
* A system variable that provides direct access to the sketch's
|
|
21832
|
-
*
|
|
21795
|
+
* `<canvas>` element.
|
|
21833
21796
|
*
|
|
21834
|
-
* The
|
|
21797
|
+
* The `<canvas>` element provides many specialized features that aren't
|
|
21835
21798
|
* included in the p5.js library. The `drawingContext` system variable
|
|
21836
21799
|
* provides access to these features by exposing the sketch's
|
|
21837
21800
|
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D">CanvasRenderingContext2D</a>
|
package/dist/shape/attributes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER, w as ROUND, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER } from '../constants-
|
|
1
|
+
import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER, w as ROUND, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER } from '../constants-BdTiYOQI.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module Shape
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as Color } from '../creating_reading-C7hu6sg1.js';
|
|
2
2
|
import { Vector } from '../math/p5.Vector.js';
|
|
3
|
-
import { J as INCLUDE, K as PATH, O as EMPTY_PATH, Q as OPEN, V as CLOSE, X as POINTS, Y as LINES, c as TRIANGLES, Z as QUADS, _ as TRIANGLE_FAN, T as TRIANGLE_STRIP, $ as QUAD_STRIP, a0 as EXCLUDE, a1 as JOIN } from '../constants-
|
|
3
|
+
import { J as INCLUDE, K as PATH, O as EMPTY_PATH, Q as OPEN, V as CLOSE, X as POINTS, Y as LINES, c as TRIANGLES, Z as QUADS, _ as TRIANGLE_FAN, T as TRIANGLE_STRIP, $ as QUAD_STRIP, a0 as EXCLUDE, a1 as JOIN } from '../constants-BdTiYOQI.js';
|
|
4
4
|
import 'colorjs.io/fn';
|
|
5
5
|
import '../color/color_spaces/hsb.js';
|
|
6
6
|
|
package/dist/shape/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import attributes from './attributes.js';
|
|
|
3
3
|
import curves from './curves.js';
|
|
4
4
|
import vertex from './vertex.js';
|
|
5
5
|
import customShapes from './custom_shapes.js';
|
|
6
|
-
import '../constants-
|
|
6
|
+
import '../constants-BdTiYOQI.js';
|
|
7
7
|
import '../core/helpers.js';
|
|
8
8
|
import '../creating_reading-C7hu6sg1.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
@@ -2,5 +2,5 @@ import './ir_dag.js';
|
|
|
2
2
|
import './ir_cfg.js';
|
|
3
3
|
import './strands_FES.js';
|
|
4
4
|
import './ir_types.js';
|
|
5
|
-
export { b as binaryOpNode, h as castToFloat, g as constructTypeFromIDs, f as functionCallNode, m as memberAccessNode, p as primitiveConstructorNode, e as scalarLiteralNode, s as statementNode, d as structConstructorNode, a as structInstanceNode, i as swizzleNode, j as swizzleTrap, u as unaryOpNode, v as variableNode } from '../ir_builders-
|
|
5
|
+
export { b as binaryOpNode, h as castToFloat, g as constructTypeFromIDs, f as functionCallNode, m as memberAccessNode, p as primitiveConstructorNode, e as scalarLiteralNode, s as statementNode, d as structConstructorNode, a as structInstanceNode, i as swizzleNode, j as swizzleTrap, u as unaryOpNode, v as variableNode } from '../ir_builders-Cd6rU9Vm.js';
|
|
6
6
|
import './strands_builtins.js';
|
|
@@ -8,7 +8,7 @@ import 'acorn';
|
|
|
8
8
|
import 'acorn-walk';
|
|
9
9
|
import 'escodegen';
|
|
10
10
|
import './strands_FES.js';
|
|
11
|
-
import '../ir_builders-
|
|
11
|
+
import '../ir_builders-Cd6rU9Vm.js';
|
|
12
12
|
import './strands_builtins.js';
|
|
13
13
|
import './strands_conditionals.js';
|
|
14
14
|
import './strands_phi_utils.js';
|
|
@@ -42,7 +42,6 @@ function strands(p5, fn) {
|
|
|
42
42
|
ctx.vertexDeclarations = new Set();
|
|
43
43
|
ctx.fragmentDeclarations = new Set();
|
|
44
44
|
ctx.hooks = [];
|
|
45
|
-
ctx.globalAssignments = [];
|
|
46
45
|
ctx.backend = backend;
|
|
47
46
|
ctx.active = active;
|
|
48
47
|
ctx.renderer = renderer;
|
|
@@ -64,7 +63,6 @@ function strands(p5, fn) {
|
|
|
64
63
|
ctx.vertexDeclarations = new Set();
|
|
65
64
|
ctx.fragmentDeclarations = new Set();
|
|
66
65
|
ctx.hooks = [];
|
|
67
|
-
ctx.globalAssignments = [];
|
|
68
66
|
ctx.active = false;
|
|
69
67
|
p5.disableFriendlyErrors = ctx.previousFES;
|
|
70
68
|
for (const key in ctx.windowOverrides) {
|
|
@@ -209,7 +207,7 @@ if (typeof p5 !== "undefined") {
|
|
|
209
207
|
* }
|
|
210
208
|
*
|
|
211
209
|
* function material() {
|
|
212
|
-
* let t =
|
|
210
|
+
* let t = millis();
|
|
213
211
|
* worldInputs.begin();
|
|
214
212
|
* // Move the vertex up and down in a wave in world space
|
|
215
213
|
* // In world space, moving the object (e.g., with translate()) will affect these coordinates
|
|
@@ -221,7 +219,6 @@ if (typeof p5 !== "undefined") {
|
|
|
221
219
|
* function draw() {
|
|
222
220
|
* background(255);
|
|
223
221
|
* shader(myShader);
|
|
224
|
-
* myShader.setUniform('t', millis());
|
|
225
222
|
* lights();
|
|
226
223
|
* noStroke();
|
|
227
224
|
* fill('red');
|
|
@@ -310,9 +307,7 @@ if (typeof p5 !== "undefined") {
|
|
|
310
307
|
* A value between `0.0` and `1.0`
|
|
311
308
|
*
|
|
312
309
|
* @example
|
|
313
|
-
*
|
|
314
|
-
* <code>
|
|
315
|
-
* // Example 1: A soft vertical fade using smoothstep (no uniforms)
|
|
310
|
+
* // Example 1: A soft vertical fade using smoothstep
|
|
316
311
|
*
|
|
317
312
|
* let fadeShader;
|
|
318
313
|
*
|
|
@@ -331,31 +326,25 @@ if (typeof p5 !== "undefined") {
|
|
|
331
326
|
*
|
|
332
327
|
* function setup() {
|
|
333
328
|
* createCanvas(300, 200, WEBGL);
|
|
334
|
-
* fadeShader =
|
|
329
|
+
* fadeShader = buildFilterShader(fadeCallback);
|
|
335
330
|
* }
|
|
336
331
|
*
|
|
337
332
|
* function draw() {
|
|
338
333
|
* background(0);
|
|
339
334
|
* filter(fadeShader);
|
|
340
335
|
* }
|
|
341
|
-
* </code>
|
|
342
|
-
* </div>
|
|
343
336
|
*
|
|
344
337
|
* @example
|
|
345
|
-
*
|
|
346
|
-
* <code>
|
|
347
|
-
* // Example 2: Animate the smooth transition using a uniform
|
|
338
|
+
* // Example 2: Animate the smooth transition over time
|
|
348
339
|
*
|
|
349
340
|
* let animatedShader;
|
|
350
341
|
*
|
|
351
342
|
* function animatedFadeCallback() {
|
|
352
|
-
* const time = uniformFloat(() => millis() * 0.001);
|
|
353
|
-
*
|
|
354
343
|
* getColor((inputs) => {
|
|
355
344
|
* let x = inputs.texCoord.x;
|
|
356
345
|
*
|
|
357
346
|
* // Move the smoothstep band back and forth over time
|
|
358
|
-
* let center = 0.5 + 0.25 * sin(
|
|
347
|
+
* let center = 0.5 + 0.25 * sin(millis() * 0.001);
|
|
359
348
|
* let t = smoothstep(center - 0.05, center + 0.05, x);
|
|
360
349
|
*
|
|
361
350
|
* return [t, t, t, 1];
|
|
@@ -364,15 +353,13 @@ if (typeof p5 !== "undefined") {
|
|
|
364
353
|
*
|
|
365
354
|
* function setup() {
|
|
366
355
|
* createCanvas(300, 200, WEBGL);
|
|
367
|
-
* animatedShader =
|
|
356
|
+
* animatedShader = buildFilterShader(animatedFadeCallback);
|
|
368
357
|
* }
|
|
369
358
|
*
|
|
370
359
|
* function draw() {
|
|
371
360
|
* background(0);
|
|
372
361
|
* filter(animatedShader);
|
|
373
362
|
* }
|
|
374
|
-
* </code>
|
|
375
|
-
* </div>
|
|
376
363
|
*/
|
|
377
364
|
|
|
378
365
|
/**
|
|
@@ -489,7 +476,7 @@ if (typeof p5 !== "undefined") {
|
|
|
489
476
|
* }
|
|
490
477
|
*
|
|
491
478
|
* function material() {
|
|
492
|
-
* let t =
|
|
479
|
+
* let t = millis();
|
|
493
480
|
* pixelInputs.begin();
|
|
494
481
|
* // Animate alpha (transparency) based on x position
|
|
495
482
|
* pixelInputs.color.a = 0.5 + 0.5 *
|
|
@@ -500,7 +487,6 @@ if (typeof p5 !== "undefined") {
|
|
|
500
487
|
* function draw() {
|
|
501
488
|
* background(240);
|
|
502
489
|
* shader(myShader);
|
|
503
|
-
* myShader.setUniform('t', millis());
|
|
504
490
|
* lights();
|
|
505
491
|
* noStroke();
|
|
506
492
|
* fill('purple');
|
|
@@ -691,7 +677,7 @@ if (typeof p5 !== "undefined") {
|
|
|
691
677
|
* }
|
|
692
678
|
*
|
|
693
679
|
* function material() {
|
|
694
|
-
* let t =
|
|
680
|
+
* let t = millis();
|
|
695
681
|
* objectInputs.begin();
|
|
696
682
|
* // Create a sine wave along the object
|
|
697
683
|
* objectInputs.position.y += sin(t * 0.001 + objectInputs.position.x);
|
|
@@ -701,7 +687,6 @@ if (typeof p5 !== "undefined") {
|
|
|
701
687
|
* function draw() {
|
|
702
688
|
* background(220);
|
|
703
689
|
* shader(myShader);
|
|
704
|
-
* myShader.setUniform('t', millis());
|
|
705
690
|
* noStroke();
|
|
706
691
|
* fill('orange');
|
|
707
692
|
* sphere(50);
|
|
@@ -733,7 +718,7 @@ if (typeof p5 !== "undefined") {
|
|
|
733
718
|
* }
|
|
734
719
|
*
|
|
735
720
|
* function material() {
|
|
736
|
-
* let t =
|
|
721
|
+
* let t = millis();
|
|
737
722
|
* cameraInputs.begin();
|
|
738
723
|
* // Move vertices in camera space based on their x position
|
|
739
724
|
* cameraInputs.position.y += 30 * sin(cameraInputs.position.x * 0.05 + t * 0.001);
|
|
@@ -745,7 +730,6 @@ if (typeof p5 !== "undefined") {
|
|
|
745
730
|
* function draw() {
|
|
746
731
|
* background(200);
|
|
747
732
|
* shader(myShader);
|
|
748
|
-
* myShader.setUniform('t', millis());
|
|
749
733
|
* noStroke();
|
|
750
734
|
* fill('red');
|
|
751
735
|
* sphere(50);
|
|
@@ -792,8 +776,6 @@ if (typeof p5 !== "undefined") {
|
|
|
792
776
|
* will behave as a vec4 holding components r, g, b, and a (alpha), with each component being in the range 0.0 to 1.0.
|
|
793
777
|
*
|
|
794
778
|
* @example
|
|
795
|
-
* <div modernizr='webgl'>
|
|
796
|
-
* <code>
|
|
797
779
|
* // A filter shader (using p5.strands) which will
|
|
798
780
|
* // sample and invert the color of each pixel
|
|
799
781
|
* // from the canvas.
|
|
@@ -826,12 +808,8 @@ if (typeof p5 !== "undefined") {
|
|
|
826
808
|
*
|
|
827
809
|
* filterColor.end();
|
|
828
810
|
* }
|
|
829
|
-
* </code>
|
|
830
|
-
*
|
|
831
811
|
*
|
|
832
812
|
* @example
|
|
833
|
-
* <div modernizr='webgl'>
|
|
834
|
-
* <code>
|
|
835
813
|
* // This primitive edge-detection filter samples
|
|
836
814
|
* // and compares the colors of the current pixel
|
|
837
815
|
* // on the canvas, and a little to the right.
|
|
@@ -888,8 +866,6 @@ if (typeof p5 !== "undefined") {
|
|
|
888
866
|
* rotate(frameCount / 300);
|
|
889
867
|
* square(0, 0, 30);
|
|
890
868
|
* }
|
|
891
|
-
* </code>
|
|
892
|
-
* </div>
|
|
893
869
|
*/
|
|
894
870
|
|
|
895
871
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as unaryOpNode, c as createStrandsNode, S as StrandsNode, p as primitiveConstructorNode, v as variableNode, b as binaryOpNode, s as statementNode, f as functionCallNode, a as structInstanceNode, d as structConstructorNode } from '../ir_builders-
|
|
1
|
+
import { u as unaryOpNode, c as createStrandsNode, S as StrandsNode, p as primitiveConstructorNode, v as variableNode, b as binaryOpNode, s as statementNode, f as functionCallNode, a as structInstanceNode, d as structConstructorNode } from '../ir_builders-Cd6rU9Vm.js';
|
|
2
2
|
import { OperatorTable, StatementType, NodeType, DataType, BaseType, BlockType, isStructType, structType } from './ir_types.js';
|
|
3
3
|
import { strandsBuiltinFunctions } from './strands_builtins.js';
|
|
4
4
|
import { StrandsConditional } from './strands_conditionals.js';
|
|
@@ -414,7 +414,6 @@ function initGlobalStrandsAPI(p5, fn, strandsContext) {
|
|
|
414
414
|
typeInfo,
|
|
415
415
|
usedInVertex: false,
|
|
416
416
|
usedInFragment: false,
|
|
417
|
-
declared: false
|
|
418
417
|
});
|
|
419
418
|
|
|
420
419
|
return createStrandsNode(id, dimension, strandsContext);
|
|
@@ -47,18 +47,6 @@ function generateShaderCode(strandsContext) {
|
|
|
47
47
|
backend.generateBlock(blockID, strandsContext, generationContext);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// Process any unvisited global assignments to ensure side effects are generated
|
|
51
|
-
for (const assignmentNodeID of strandsContext.globalAssignments) {
|
|
52
|
-
if (!generationContext.visitedNodes.has(assignmentNodeID)) {
|
|
53
|
-
// This assignment hasn't been visited yet, so we need to generate it
|
|
54
|
-
backend.generateAssignment(generationContext, strandsContext.dag, assignmentNodeID);
|
|
55
|
-
generationContext.visitedNodes.add(assignmentNodeID);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Reset global assignments for next hook
|
|
60
|
-
strandsContext.globalAssignments = [];
|
|
61
|
-
|
|
62
50
|
const firstLine = backend.hookEntry(hookType);
|
|
63
51
|
let returnType;
|
|
64
52
|
if (hookType.returnType.properties) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBasicBlock, addEdge, pushBlock, popBlock, pushBlockForModification, recordInBasicBlock } from './ir_cfg.js';
|
|
2
2
|
import { getOrCreateNode } from './ir_dag.js';
|
|
3
3
|
import { BlockType, NodeType } from './ir_types.js';
|
|
4
|
-
import { c as createStrandsNode } from '../ir_builders-
|
|
4
|
+
import { c as createStrandsNode } from '../ir_builders-Cd6rU9Vm.js';
|
|
5
5
|
import { createPhiNode } from './strands_phi_utils.js';
|
|
6
6
|
import './strands_FES.js';
|
|
7
7
|
import './strands_builtins.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBasicBlock, addEdge, pushBlock, popBlock, pushBlockForModification, recordInBasicBlock } from './ir_cfg.js';
|
|
2
2
|
import { getNodeDataFromID, createNodeData, getOrCreateNode } from './ir_dag.js';
|
|
3
3
|
import { BlockType, NodeType, StatementType, OpCode, BaseType } from './ir_types.js';
|
|
4
|
-
import { c as createStrandsNode, p as primitiveConstructorNode } from '../ir_builders-
|
|
4
|
+
import { c as createStrandsNode, p as primitiveConstructorNode } from '../ir_builders-Cd6rU9Vm.js';
|
|
5
5
|
import { createPhiNode } from './strands_phi_utils.js';
|
|
6
6
|
import './strands_FES.js';
|
|
7
7
|
import './strands_builtins.js';
|
package/dist/type/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import textCore from './textCore.js';
|
|
2
2
|
import font from './p5.Font.js';
|
|
3
|
-
import '../p5.Renderer-
|
|
3
|
+
import '../p5.Renderer-BmD2P6Wv.js';
|
|
4
4
|
import '../creating_reading-C7hu6sg1.js';
|
|
5
5
|
import 'colorjs.io/fn';
|
|
6
6
|
import '../color/color_spaces/hsb.js';
|
|
7
|
-
import '../constants-
|
|
7
|
+
import '../constants-BdTiYOQI.js';
|
|
8
8
|
import '../image/filters.js';
|
|
9
9
|
import '../math/p5.Vector.js';
|
|
10
10
|
import '../shape/custom_shapes.js';
|
package/dist/type/p5.Font.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { textCoreConstants } from './textCore.js';
|
|
2
|
-
import { v as CENTER, a9 as RIGHT, u as RADIUS } from '../constants-
|
|
2
|
+
import { v as CENTER, a9 as RIGHT, u as RADIUS } from '../constants-BdTiYOQI.js';
|
|
3
3
|
import { UnicodeRange } from '@japont/unicode-range';
|
|
4
4
|
import { unicodeRanges } from './unicodeRanges.js';
|
|
5
5
|
import { Vector } from '../math/p5.Vector.js';
|
|
6
6
|
import Typr from './lib/Typr.js';
|
|
7
7
|
import { createFromCommands } from '@davepagurek/bezier-path';
|
|
8
|
-
import '../p5.Renderer-
|
|
8
|
+
import '../p5.Renderer-BmD2P6Wv.js';
|
|
9
9
|
import '../creating_reading-C7hu6sg1.js';
|
|
10
10
|
import 'colorjs.io/fn';
|
|
11
11
|
import '../color/color_spaces/hsb.js';
|
package/dist/type/textCore.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as Renderer } from '../p5.Renderer-
|
|
1
|
+
import { R as Renderer } from '../p5.Renderer-BmD2P6Wv.js';
|
|
2
2
|
import '../creating_reading-C7hu6sg1.js';
|
|
3
3
|
import 'colorjs.io/fn';
|
|
4
4
|
import '../color/color_spaces/hsb.js';
|
|
5
|
-
import '../constants-
|
|
5
|
+
import '../constants-BdTiYOQI.js';
|
|
6
6
|
import '../image/filters.js';
|
|
7
7
|
import '../math/p5.Vector.js';
|
|
8
8
|
import '../shape/custom_shapes.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../constants-
|
|
2
|
-
export { p as default } from '../rendering-
|
|
1
|
+
import '../constants-BdTiYOQI.js';
|
|
2
|
+
export { p as default } from '../rendering-CC8JNTwG.js';
|
|
3
3
|
import '../math/p5.Vector.js';
|
|
4
4
|
import './p5.Geometry.js';
|
|
5
5
|
import '../math/p5.Matrix.js';
|
|
@@ -10,7 +10,7 @@ import '../color/color_spaces/hsb.js';
|
|
|
10
10
|
import '../dom/p5.Element.js';
|
|
11
11
|
import '../dom/p5.File.js';
|
|
12
12
|
import '../io/p5.XML.js';
|
|
13
|
-
import '../p5.Renderer-
|
|
13
|
+
import '../p5.Renderer-BmD2P6Wv.js';
|
|
14
14
|
import '../image/filters.js';
|
|
15
15
|
import '../shape/custom_shapes.js';
|
|
16
16
|
import '../core/States.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TRIANGLE_STRIP, $ as QUAD_STRIP, _ as TRIANGLE_FAN, c as TRIANGLES } from '../constants-
|
|
1
|
+
import { T as TRIANGLE_STRIP, $ as QUAD_STRIP, _ as TRIANGLE_FAN, c as TRIANGLES } from '../constants-BdTiYOQI.js';
|
|
2
2
|
import '../math/p5.Matrix.js';
|
|
3
3
|
import { Geometry } from './p5.Geometry.js';
|
|
4
4
|
import { Matrix } from '../math/Matrices/Matrix.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as PATH, Z as QUADS, $ as QUAD_STRIP, T as TRIANGLE_STRIP, c as TRIANGLES, ad as IMAGE, Y as LINES, _ as TRIANGLE_FAN } from '../constants-
|
|
1
|
+
import { K as PATH, Z as QUADS, $ as QUAD_STRIP, T as TRIANGLE_STRIP, c as TRIANGLES, ad as IMAGE, Y as LINES, _ as TRIANGLE_FAN } from '../constants-BdTiYOQI.js';
|
|
2
2
|
import { Geometry } from './p5.Geometry.js';
|
|
3
3
|
import libtess from 'libtess';
|
|
4
4
|
import { Vector } from '../math/p5.Vector.js';
|
package/dist/webgl/enums.js
CHANGED