p5 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +2 -2
  3. package/{src → dist}/accessibility/gridOutput.js +2 -2
  4. package/dist/accessibility/index.js +60 -0
  5. package/{src → dist}/accessibility/outputs.js +2 -2
  6. package/{src → dist}/accessibility/textOutput.js +2 -2
  7. package/dist/app.js +120 -0
  8. package/{src → dist}/color/color_conversion.js +48 -10
  9. package/{src → dist}/color/color_spaces/hsb.js +3 -1
  10. package/dist/color/creating_reading.js +3 -0
  11. package/dist/color/index.js +13 -0
  12. package/dist/color/p5.Color.culori.js +1 -0
  13. package/dist/color/p5.Color.js +3 -0
  14. package/{src → dist}/color/setting.js +9 -6
  15. package/{src/core/constants.js → dist/constants-C-g_eAdC.js} +266 -130
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +7 -6
  19. package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
  20. package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
  21. package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
  22. package/dist/core/friendly_errors/index.js +23 -0
  23. package/dist/core/friendly_errors/param_validator.js +5455 -0
  24. package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
  25. package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
  26. package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
  27. package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
  28. package/{src → dist}/core/helpers.js +9 -6
  29. package/dist/core/init.js +105 -0
  30. package/dist/core/internationalization.js +302 -0
  31. package/dist/core/legacy.js +73 -0
  32. package/dist/core/main.js +44 -0
  33. package/dist/core/noop.js +3 -0
  34. package/dist/core/p5.Graphics.js +40 -0
  35. package/dist/core/p5.Renderer.js +11 -0
  36. package/dist/core/p5.Renderer2D.js +44 -0
  37. package/dist/core/reference.js +1 -0
  38. package/dist/core/rendering.js +40 -0
  39. package/{src → dist}/core/structure.js +3 -3
  40. package/{src → dist}/core/transform.js +2 -2
  41. package/{src/color/creating_reading.js → dist/creating_reading-D4AAKRbx.js} +841 -13
  42. package/{src → dist}/data/index.js +3 -1
  43. package/{src → dist}/data/local_storage.js +2 -8
  44. package/{src → dist}/dom/dom.js +11 -5
  45. package/dist/dom/index.js +18 -0
  46. package/{src → dist}/dom/p5.Element.js +14 -12
  47. package/{src → dist}/dom/p5.File.js +4 -4
  48. package/{src → dist}/dom/p5.MediaElement.js +10 -4
  49. package/{src → dist}/events/acceleration.js +2 -2
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -11
  52. package/{src → dist}/events/pointer.js +16 -17
  53. package/dist/image/const.js +9 -0
  54. package/{src → dist}/image/filterRenderer2D.js +57 -37
  55. package/{src → dist}/image/filters.js +1 -3
  56. package/dist/image/image.js +40 -0
  57. package/dist/image/index.js +51 -0
  58. package/dist/image/loading_displaying.js +40 -0
  59. package/dist/image/p5.Image.js +11 -0
  60. package/{src → dist}/image/pixels.js +4 -3
  61. package/{src → dist}/io/csv.js +72 -70
  62. package/dist/io/files.js +40 -0
  63. package/dist/io/index.js +51 -0
  64. package/{src → dist}/io/p5.Table.js +6 -6
  65. package/{src → dist}/io/p5.TableRow.js +3 -4
  66. package/{src → dist}/io/p5.XML.js +2 -5
  67. package/{src → dist}/io/utilities.js +1 -1
  68. package/{src/core/p5.Renderer2D.js → dist/main-s72KWcUy.js} +735 -57
  69. package/{src → dist}/math/Matrices/Matrix.js +10 -8
  70. package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
  71. package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
  72. package/{src → dist}/math/calculation.js +2 -2
  73. package/{src → dist}/math/index.js +6 -3
  74. package/{src → dist}/math/math.js +2 -2
  75. package/{src → dist}/math/noise.js +2 -2
  76. package/{src → dist}/math/p5.Matrix.js +7 -4
  77. package/{src → dist}/math/p5.Vector.js +6 -6
  78. package/{src → dist}/math/random.js +2 -2
  79. package/{src → dist}/math/trigonometry.js +16 -15
  80. package/{src/image/p5.Image.js → dist/p5.Renderer-CwAYZOC2.js} +390 -19
  81. package/dist/rendering--aAe5aq3.js +24925 -0
  82. package/{src → dist}/shape/2d_primitives.js +18 -17
  83. package/{src → dist}/shape/attributes.js +18 -17
  84. package/{src → dist}/shape/curves.js +2 -2
  85. package/{src → dist}/shape/custom_shapes.js +44 -64
  86. package/{src → dist}/shape/index.js +10 -2
  87. package/{src → dist}/shape/vertex.js +2 -3
  88. package/dist/type/index.js +25 -0
  89. package/{src → dist}/type/lib/Typr.js +76 -94
  90. package/{src → dist}/type/p5.Font.js +37 -61
  91. package/{src → dist}/type/textCore.js +34 -57
  92. package/{src → dist}/type/unicodeRanges.js +3 -1
  93. package/{src → dist}/utilities/conversion.js +2 -2
  94. package/{src → dist}/utilities/index.js +3 -1
  95. package/{src → dist}/utilities/time_date.js +6 -7
  96. package/{src → dist}/utilities/utility_functions.js +2 -2
  97. package/dist/webgl/3d_primitives.js +40 -0
  98. package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
  99. package/{src → dist}/webgl/GeometryBuilder.js +12 -8
  100. package/{src → dist}/webgl/ShaderGenerator.js +79 -82
  101. package/{src → dist}/webgl/ShapeBuilder.js +26 -23
  102. package/dist/webgl/index.js +76 -0
  103. package/{src → dist}/webgl/interaction.js +7 -6
  104. package/dist/webgl/light.js +40 -0
  105. package/{src → dist}/webgl/loading.js +45 -12
  106. package/dist/webgl/material.js +40 -0
  107. package/dist/webgl/p5.Camera.js +40 -0
  108. package/{src → dist}/webgl/p5.DataArray.js +3 -5
  109. package/dist/webgl/p5.Framebuffer.js +40 -0
  110. package/{src → dist}/webgl/p5.Geometry.js +12 -15
  111. package/{src → dist}/webgl/p5.Quat.js +5 -4
  112. package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
  113. package/dist/webgl/p5.RendererGL.js +40 -0
  114. package/dist/webgl/p5.Shader.js +40 -0
  115. package/dist/webgl/p5.Texture.js +40 -0
  116. package/{src → dist}/webgl/text.js +51 -9
  117. package/lib/p5.esm.js +102 -48
  118. package/lib/p5.js +102 -48
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -16
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/src/README.md +0 -27
  124. package/src/accessibility/index.js +0 -13
  125. package/src/app.js +0 -61
  126. package/src/color/index.js +0 -9
  127. package/src/color/p5.Color.culori.js +0 -66
  128. package/src/color/p5.Color.js +0 -851
  129. package/src/core/README.md +0 -91
  130. package/src/core/friendly_errors/index.js +0 -13
  131. package/src/core/friendly_errors/param_validator.js +0 -561
  132. package/src/core/init.js +0 -58
  133. package/src/core/internationalization.js +0 -195
  134. package/src/core/legacy.js +0 -29
  135. package/src/core/main.js +0 -689
  136. package/src/core/noop.js +0 -1
  137. package/src/core/p5.Graphics.js +0 -696
  138. package/src/core/p5.Renderer.js +0 -408
  139. package/src/core/reference.js +0 -2060
  140. package/src/core/rendering.js +0 -697
  141. package/src/dom/index.js +0 -11
  142. package/src/image/const.js +0 -6
  143. package/src/image/image.js +0 -731
  144. package/src/image/index.js +0 -15
  145. package/src/image/loading_displaying.js +0 -1431
  146. package/src/io/files.js +0 -2210
  147. package/src/io/index.js +0 -11
  148. package/src/math/README.md +0 -40
  149. package/src/type/index.js +0 -9
  150. package/src/webgl/3d_primitives.js +0 -2741
  151. package/src/webgl/index.js +0 -37
  152. package/src/webgl/light.js +0 -1851
  153. package/src/webgl/material.js +0 -3854
  154. package/src/webgl/p5.Camera.js +0 -4010
  155. package/src/webgl/p5.Framebuffer.js +0 -1865
  156. package/src/webgl/p5.RendererGL.js +0 -2867
  157. package/src/webgl/p5.Shader.js +0 -1505
  158. package/src/webgl/p5.Texture.js +0 -541
  159. package/src/webgl/shaders/basic.frag +0 -6
  160. package/src/webgl/shaders/filters/base.frag +0 -22
  161. package/src/webgl/shaders/filters/base.vert +0 -19
  162. package/src/webgl/shaders/filters/blur.frag +0 -60
  163. package/src/webgl/shaders/filters/default.vert +0 -18
  164. package/src/webgl/shaders/filters/dilate.frag +0 -39
  165. package/src/webgl/shaders/filters/erode.frag +0 -39
  166. package/src/webgl/shaders/filters/gray.frag +0 -16
  167. package/src/webgl/shaders/filters/invert.frag +0 -15
  168. package/src/webgl/shaders/filters/opaque.frag +0 -12
  169. package/src/webgl/shaders/filters/posterize.frag +0 -29
  170. package/src/webgl/shaders/filters/threshold.frag +0 -23
  171. package/src/webgl/shaders/font.frag +0 -216
  172. package/src/webgl/shaders/font.vert +0 -44
  173. package/src/webgl/shaders/imageLight.vert +0 -33
  174. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  175. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  176. package/src/webgl/shaders/light.vert +0 -37
  177. package/src/webgl/shaders/light_texture.frag +0 -26
  178. package/src/webgl/shaders/lighting.glsl +0 -227
  179. package/src/webgl/shaders/line.frag +0 -74
  180. package/src/webgl/shaders/line.vert +0 -294
  181. package/src/webgl/shaders/normal.frag +0 -6
  182. package/src/webgl/shaders/normal.vert +0 -72
  183. package/src/webgl/shaders/phong.frag +0 -84
  184. package/src/webgl/shaders/phong.vert +0 -87
  185. package/src/webgl/shaders/point.frag +0 -29
  186. package/src/webgl/shaders/point.vert +0 -19
  187. package/src/webgl/shaders/sphereMapping.frag +0 -26
  188. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,9 +1,11 @@
1
+ import { Vector } from '../p5.Vector.js';
2
+ import { MatrixInterface } from './MatrixInterface.js';
3
+ import '../../constants-C-g_eAdC.js';
4
+
1
5
  /**
2
6
  * @module Math
3
7
  */
4
8
 
5
- import { Vector } from "../p5.Vector";
6
- import { MatrixInterface } from "./MatrixInterface";
7
9
 
8
10
  const isPerfectSquare = (arr) => {
9
11
  const sqDimention = Math.sqrt(Array.from(arr).length);
@@ -13,14 +15,14 @@ const isPerfectSquare = (arr) => {
13
15
  return true;
14
16
  };
15
17
 
16
- export let GLMAT_ARRAY_TYPE = Array;
17
- export let isMatrixArray = (x) => Array.isArray(x);
18
+ let GLMAT_ARRAY_TYPE = Array;
19
+ let isMatrixArray = (x) => Array.isArray(x);
18
20
  if (typeof Float32Array !== "undefined") {
19
21
  GLMAT_ARRAY_TYPE = Float32Array;
20
22
  isMatrixArray = (x) => Array.isArray(x) || x instanceof Float32Array;
21
23
  }
22
24
 
23
- export class Matrix extends MatrixInterface {
25
+ class Matrix extends MatrixInterface {
24
26
  matrix;
25
27
  #sqDimention;
26
28
 
@@ -570,9 +572,7 @@ export class Matrix extends MatrixInterface {
570
572
  _src = multMatrix;
571
573
  } else if (isPerfectSquare(arguments)) {
572
574
  _src = Array.from(arguments);
573
- } else {
574
- return; // nothing to do.
575
- }
575
+ } else ;
576
576
  if (this.#sqDimention === 4 && _src.length === 16) {
577
577
  return this.#mult4x4(_src);
578
578
  } else if (this.#sqDimention === 3 && _src.length === 9) {
@@ -2122,3 +2122,5 @@ export class Matrix extends MatrixInterface {
2122
2122
  // 0.0,0.0,0.0,1.0
2123
2123
  //];
2124
2124
  }
2125
+
2126
+ export { GLMAT_ARRAY_TYPE, Matrix, isMatrixArray };
@@ -1,10 +1,10 @@
1
- export let GLMAT_ARRAY_TYPE = Array;
2
- export let isMatrixArray = (x) => Array.isArray(x);
1
+ let GLMAT_ARRAY_TYPE = Array;
2
+ let isMatrixArray = (x) => Array.isArray(x);
3
3
  if (typeof Float32Array !== "undefined") {
4
4
  GLMAT_ARRAY_TYPE = Float32Array;
5
5
  isMatrixArray = (x) => Array.isArray(x) || x instanceof Float32Array;
6
6
  }
7
- export class MatrixInterface {
7
+ class MatrixInterface {
8
8
  // Private field to store the matrix
9
9
  #matrix = null;
10
10
  constructor(...args) {
@@ -51,3 +51,5 @@ export class MatrixInterface {
51
51
  });
52
52
  }
53
53
  }
54
+
55
+ export { GLMAT_ARRAY_TYPE, MatrixInterface, isMatrixArray };
@@ -1,20 +1,10 @@
1
- import nj from "@d4c/numjs/build/module/numjs.min.js";
2
- import { Vector } from "../p5.Vector";
3
- import { MatrixInterface } from "./MatrixInterface";
1
+ import nj from '@d4c/numjs/build/module/numjs.min.js';
2
+ import { Vector } from '../p5.Vector.js';
3
+ import { MatrixInterface } from './MatrixInterface.js';
4
+ import '../../constants-C-g_eAdC.js';
4
5
 
5
- /**
6
- * @requires constants
7
- * @todo see methods below needing further implementation.
8
- * future consideration: implement SIMD optimizations
9
- * when browser compatibility becomes available
10
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/
11
- * Reference/Global_Objects/SIMD
12
- */
13
-
14
- let GLMAT_ARRAY_TYPE = Array;
15
6
  let isMatrixArray = (x) => Array.isArray(x);
16
7
  if (typeof Float32Array !== "undefined") {
17
- GLMAT_ARRAY_TYPE = Float32Array;
18
8
  isMatrixArray = (x) => Array.isArray(x) || x instanceof Float32Array;
19
9
  }
20
10
 
@@ -46,10 +36,10 @@ if (typeof Float32Array !== "undefined") {
46
36
  * </div>
47
37
  */
48
38
  // const matrixEngine = "numjs";
49
- export class MatrixNumjs extends MatrixInterface{
39
+ class MatrixNumjs extends MatrixInterface{
50
40
  constructor(...args) {
51
41
  // This is default behavior when object
52
- super(...args)
42
+ super(...args);
53
43
 
54
44
  if (args[0] === 3) {
55
45
  this._mat3 = Array.isArray(args[1]) ? nj.array(args[1]) : nj.identity(3);
@@ -137,7 +127,7 @@ export class MatrixNumjs extends MatrixInterface{
137
127
  * @return {MatrixNumjs} the copy of the MatrixNumjs object
138
128
  */
139
129
  get() {
140
- let temp = new MatrixNumjs(this.mat4);
130
+ new MatrixNumjs(this.mat4);
141
131
  return new MatrixNumjs(this.mat4);
142
132
  }
143
133
 
@@ -354,9 +344,7 @@ export class MatrixNumjs extends MatrixInterface{
354
344
  * @todo finish implementation
355
345
  */
356
346
  inverseTranspose({ mat4 }) {
357
- if (this._mat3 === undefined) {
358
- // p5._friendlyError("sorry, this function only works with mat3");
359
- } else {
347
+ if (this._mat3 === undefined) ; else {
360
348
  //convert mat4 -> mat3
361
349
  this._mat3 = this._mat3.flatten();
362
350
  this._mat3.set(0, mat4[0]);
@@ -528,7 +516,7 @@ export class MatrixNumjs extends MatrixInterface{
528
516
  x = x[0]; // must be last
529
517
  }
530
518
  this._mat4 = this._mat4.flatten();
531
- const vect = nj.array([x, y, z, 1]);
519
+ nj.array([x, y, z, 1]);
532
520
  this._mat4.set(0, x * this._mat4.get(0));
533
521
  this._mat4.set(1, x * this._mat4.get(1));
534
522
  this._mat4.set(2, x * this._mat4.get(2));
@@ -811,12 +799,9 @@ export class MatrixNumjs extends MatrixInterface{
811
799
  * @chainable
812
800
  */
813
801
  mult3x3(multMatrix) {
814
- let _src;
815
802
  let tempMatrix = multMatrix;
816
- if (multMatrix === this || multMatrix === this._mat3) {
817
- // mat3; // only need to allocate in this rare case
818
- } else if (multMatrix instanceof MatrixNumjs) {
819
- _src = multMatrix.mat3;
803
+ if (multMatrix === this || multMatrix === this._mat3) ; else if (multMatrix instanceof MatrixNumjs) {
804
+ multMatrix.mat3;
820
805
  } else if (isMatrixArray(multMatrix)) {
821
806
  multMatrix._mat3 = nj.array(arguments);
822
807
  } else if (arguments.length === 9) {
@@ -964,3 +949,4 @@ export class MatrixNumjs extends MatrixInterface{
964
949
  //];
965
950
  }
966
951
 
952
+ export { MatrixNumjs };
@@ -1115,8 +1115,8 @@ function calculation(p5, fn){
1115
1115
  };
1116
1116
  }
1117
1117
 
1118
- export default calculation;
1119
-
1120
1118
  if(typeof p5 !== 'undefined'){
1121
1119
  calculation(p5, p5.prototype);
1122
1120
  }
1121
+
1122
+ export { calculation as default };
@@ -2,14 +2,17 @@ import calculation from './calculation.js';
2
2
  import noise from './noise.js';
3
3
  import random from './random.js';
4
4
  import trigonometry from './trigonometry.js';
5
- import math from './math.js';
5
+ import math$1 from './math.js';
6
6
  import vector from './p5.Vector.js';
7
+ import '../constants-C-g_eAdC.js';
7
8
 
8
- export default function(p5){
9
+ function math(p5){
9
10
  p5.registerAddon(calculation);
10
11
  p5.registerAddon(noise);
11
12
  p5.registerAddon(random);
12
13
  p5.registerAddon(trigonometry);
13
- p5.registerAddon(math);
14
+ p5.registerAddon(math$1);
14
15
  p5.registerAddon(vector);
15
16
  }
17
+
18
+ export { math as default };
@@ -135,8 +135,8 @@ function math(p5, fn) {
135
135
  };
136
136
  }
137
137
 
138
- export default math;
139
-
140
138
  if (typeof p5 !== "undefined") {
141
139
  math(p5, p5.prototype);
142
140
  }
141
+
142
+ export { math as default };
@@ -479,8 +479,8 @@ function noise(p5, fn){
479
479
  };
480
480
  }
481
481
 
482
- export default noise;
483
-
484
482
  if(typeof p5 !== 'undefined'){
485
483
  noise(p5, p5.prototype);
486
484
  }
485
+
486
+ export { noise as default };
@@ -1,3 +1,8 @@
1
+ import { Matrix } from './Matrices/Matrix.js';
2
+ import './p5.Vector.js';
3
+ import '../constants-C-g_eAdC.js';
4
+ import './Matrices/MatrixInterface.js';
5
+
1
6
  /**
2
7
  * @module Math
3
8
  * @requires constants
@@ -7,7 +12,6 @@
7
12
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/
8
13
  * Reference/Global_Objects/SIMD
9
14
  */
10
- import { Matrix } from "./Matrices/Matrix";
11
15
  // import { MatrixNumjs as Matrix } from './Matrices/MatrixNumjs'
12
16
 
13
17
  function matrix(p5, fn) {
@@ -108,9 +112,8 @@ function matrix(p5, fn) {
108
112
  p5.Matrix = Matrix;
109
113
  }
110
114
 
111
- export default matrix;
112
- export { Matrix };
113
-
114
115
  if (typeof p5 !== "undefined") {
115
116
  matrix(p5, p5.prototype);
116
117
  }
118
+
119
+ export { Matrix, matrix as default };
@@ -1,9 +1,10 @@
1
+ import { f as TWO_PI } from '../constants-C-g_eAdC.js';
2
+
1
3
  /**
2
4
  * @module Math
3
5
  * @requires constants
4
6
  */
5
7
 
6
- import * as constants from "../core/constants";
7
8
 
8
9
  /// HELPERS FOR REMAINDER METHOD
9
10
  const calculateRemainder2D = function (xComponent, yComponent) {
@@ -3293,7 +3294,7 @@ class Vector {
3293
3294
  * </div>
3294
3295
  */
3295
3296
  static random2D() {
3296
- return this.fromAngle(Math.random() * constants.TWO_PI);
3297
+ return this.fromAngle(Math.random() * TWO_PI);
3297
3298
  }
3298
3299
 
3299
3300
  /**
@@ -3316,7 +3317,7 @@ class Vector {
3316
3317
  * </div>
3317
3318
  */
3318
3319
  static random3D() {
3319
- const angle = Math.random() * constants.TWO_PI;
3320
+ const angle = Math.random() * TWO_PI;
3320
3321
  const vz = Math.random() * 2 - 1;
3321
3322
  const vzBase = Math.sqrt(1 - vz * vz);
3322
3323
  const vx = vzBase * Math.cos(angle);
@@ -3928,9 +3929,8 @@ function vector(p5, fn) {
3928
3929
  */
3929
3930
  }
3930
3931
 
3931
- export default vector;
3932
- export { Vector };
3933
-
3934
3932
  if (typeof p5 !== "undefined") {
3935
3933
  vector(p5, p5.prototype);
3936
3934
  }
3935
+
3936
+ export { Vector, vector as default };
@@ -372,8 +372,8 @@ function random(p5, fn){
372
372
  };
373
373
  }
374
374
 
375
- export default random;
376
-
377
375
  if(typeof p5 !== 'undefined'){
378
376
  random(p5, p5.prototype);
379
377
  }
378
+
379
+ export { random as default };
@@ -1,3 +1,5 @@
1
+ import { x as RAD_TO_DEG, D as DEG_TO_RAD } from '../constants-C-g_eAdC.js';
2
+
1
3
  /**
2
4
  * @module Math
3
5
  * @submodule Trigonometry
@@ -6,7 +8,6 @@
6
8
  * @requires constants
7
9
  */
8
10
 
9
- import * as constants from '../core/constants';
10
11
 
11
12
  function trigonometry(p5, fn){
12
13
  const DEGREES = fn.DEGREES = 'degrees';
@@ -516,7 +517,7 @@ function trigonometry(p5, fn){
516
517
  * </code>
517
518
  * </div>
518
519
  */
519
- fn.degrees = angle => angle * constants.RAD_TO_DEG;
520
+ fn.degrees = angle => angle * RAD_TO_DEG;
520
521
 
521
522
  /**
522
523
  * Converts an angle measured in degrees to its value in radians.
@@ -552,7 +553,7 @@ function trigonometry(p5, fn){
552
553
  * </code>
553
554
  * </div>
554
555
  */
555
- fn.radians = angle => angle * constants.DEG_TO_RAD;
556
+ fn.radians = angle => angle * DEG_TO_RAD;
556
557
 
557
558
  /**
558
559
  * Changes the unit system used to measure angles.
@@ -757,14 +758,14 @@ function trigonometry(p5, fn){
757
758
  // This is necessary for acceleration events to work properly
758
759
  if(mode === RADIANS) {
759
760
  // Change pRotation to radians
760
- this.pRotationX = this.pRotationX * constants.DEG_TO_RAD;
761
- this.pRotationY = this.pRotationY * constants.DEG_TO_RAD;
762
- this.pRotationZ = this.pRotationZ * constants.DEG_TO_RAD;
761
+ this.pRotationX = this.pRotationX * DEG_TO_RAD;
762
+ this.pRotationY = this.pRotationY * DEG_TO_RAD;
763
+ this.pRotationZ = this.pRotationZ * DEG_TO_RAD;
763
764
  } else {
764
765
  // Change pRotation to degrees
765
- this.pRotationX = this.pRotationX * constants.RAD_TO_DEG;
766
- this.pRotationY = this.pRotationY * constants.RAD_TO_DEG;
767
- this.pRotationZ = this.pRotationZ * constants.RAD_TO_DEG;
766
+ this.pRotationX = this.pRotationX * RAD_TO_DEG;
767
+ this.pRotationY = this.pRotationY * RAD_TO_DEG;
768
+ this.pRotationZ = this.pRotationZ * RAD_TO_DEG;
768
769
  }
769
770
 
770
771
  this._angleMode = mode;
@@ -781,7 +782,7 @@ function trigonometry(p5, fn){
781
782
  */
782
783
  fn._toRadians = function(angle) {
783
784
  if (this._angleMode === DEGREES) {
784
- return angle * constants.DEG_TO_RAD;
785
+ return angle * DEG_TO_RAD;
785
786
  }
786
787
  return angle;
787
788
  };
@@ -796,7 +797,7 @@ function trigonometry(p5, fn){
796
797
  */
797
798
  fn._toDegrees = function(angle) {
798
799
  if (this._angleMode === RADIANS) {
799
- return angle * constants.RAD_TO_DEG;
800
+ return angle * RAD_TO_DEG;
800
801
  }
801
802
  return angle;
802
803
  };
@@ -811,7 +812,7 @@ function trigonometry(p5, fn){
811
812
  */
812
813
  fn._fromRadians = function(angle) {
813
814
  if (this._angleMode === DEGREES) {
814
- return angle * constants.RAD_TO_DEG;
815
+ return angle * RAD_TO_DEG;
815
816
  }
816
817
  return angle;
817
818
  };
@@ -826,14 +827,14 @@ function trigonometry(p5, fn){
826
827
  */
827
828
  fn._fromDegrees = function(angle) {
828
829
  if (this._angleMode === RADIANS) {
829
- return angle * constants.DEG_TO_RAD;
830
+ return angle * DEG_TO_RAD;
830
831
  }
831
832
  return angle;
832
833
  };
833
834
  }
834
835
 
835
- export default trigonometry;
836
-
837
836
  if(typeof p5 !== 'undefined'){
838
837
  trigonometry(p5, p5.prototype);
839
838
  }
839
+
840
+ export { trigonometry as default };