diff --git a/.all-contributorsrc b/.all-contributorsrc
index 27896705eb..be96df1aca 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -2247,9 +2247,145 @@
"name": "Rishabh Taparia",
"avatar_url": "https://avatars0.githubusercontent.com/u/63252510?v=4",
"profile": "https://github.com/rt1301",
+ "contributions": [
+ "code",
+ "doc"
+ ]
+ },
+ {
+ "login": "dansarno",
+ "name": "Daniel Sarno",
+ "avatar_url": "https://avatars0.githubusercontent.com/u/48413743?v=4",
+ "profile": "https://github.com/dansarno",
+ "contributions": [
+ "example"
+ ]
+ },
+ {
+ "login": "KKVANONYMOUS",
+ "name": "Kunal Kumar Verma",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/58628586?v=4",
+ "profile": "https://kkvanonymous.github.io/",
+ "contributions": [
+ "doc",
+ "bug",
+ "code"
+ ]
+ },
+ {
+ "login": "BharathKumarRavichandran",
+ "name": "Bharath Kumar R",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/16106573?v=4",
+ "profile": "http://bharathkumarravichandran.github.io",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "TraXIcoN",
+ "name": "Aditya Mohan",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/54040096?v=4",
+ "profile": "https://www.linkedin.com/in/aditya-mohan-b1ba7a182/",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "covalentbond",
+ "name": "Arijit Kundu",
+ "avatar_url": "https://avatars1.githubusercontent.com/u/53327173?v=4",
+ "profile": "https://www.linkedin.com/in/arijit-kundu/",
+ "contributions": [
+ "bug",
+ "code",
+ "doc"
+ ]
+ },
+ {
+ "login": "tannerdolby",
+ "name": "Tanner Dolby",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/48612525?v=4",
+ "profile": "https://tannerdolby.com",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "samdelong",
+ "name": "sam delong",
+ "avatar_url": "https://avatars0.githubusercontent.com/u/20839292?v=4",
+ "profile": "https://samdelong.com",
"contributions": [
"code"
]
+ },
+ {
+ "login": "archtaurus",
+ "name": "Zhao Xin",
+ "avatar_url": "https://avatars0.githubusercontent.com/u/1265068?v=4",
+ "profile": "https://www.haoohaoo.com",
+ "contributions": [
+ "code",
+ "review"
+ ]
+ },
+ {
+ "login": "siv2r",
+ "name": "Sivaram D",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/56887198?v=4",
+ "profile": "https://github.com/siv2r",
+ "contributions": [
+ "doc",
+ "code"
+ ]
+ },
+ {
+ "login": "frappelatte28",
+ "name": "Pragya",
+ "avatar_url": "https://avatars0.githubusercontent.com/u/64382399?v=4",
+ "profile": "https://github.com/frappelatte28",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "myselfhimself",
+ "name": "Jonathan-David Schröder",
+ "avatar_url": "https://avatars.githubusercontent.com/u/1265346?v=4",
+ "profile": "https://github.com/myselfhimself",
+ "contributions": [
+ "ideas",
+ "code"
+ ]
+ },
+ {
+ "login": "ShenpaiSharma",
+ "name": "Shubham Kumar",
+ "avatar_url": "https://avatars.githubusercontent.com/u/47415702?v=4",
+ "profile": "https://github.com/ShenpaiSharma",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "nakednous",
+ "name": "Jean Pierre Charalambos",
+ "avatar_url": "https://avatars.githubusercontent.com/u/645599?&v=4",
+ "profile": "https://github.com/nakednous",
+ "contributions": [
+ "code",
+ "tool"
+ ]
+ },
+ {
+ "login": "satyasaibhushan",
+ "name": "Sai Bhushan",
+ "avatar_url": "https://avatars.githubusercontent.com/u/40578313?v=4",
+ "profile": "https://github.com/satyasaibhushan",
+ "contributions": [
+ "code",
+ "doc"
+ ]
}
],
"repoType": "github",
diff --git a/README.md b/README.md
index 8466b5c4b6..47ec6855c7 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,8 @@ Anyone interested can volunteer to be a steward! There are no specific requireme
* [@lmccart](https://github.com/lmccart)
* [@outofambit](https://github.com/outofambit)
* [@limzykenneth](https://github.com/limzykenneth)
+* [@stalgiag](https://github.com/stalgiag)
+* [@montoyamoraga](https://github.com/montoyamoraga)
| Area | Steward(s) |
| :-------------------------------- | :------------------------------------------- |
@@ -67,12 +69,12 @@ Anyone interested can volunteer to be a steward! There are no specific requireme
| Data | |
| DOM | outofambit |
| Events | outofambit
limzykenneth |
-| Image | |
+| Image | stalgiag |
| IO | limzykenneth |
| Math | limzykenneth |
| Typography | |
| Utilities | |
-| WebGL | |
+| WebGL | stalgiag |
| Build Process/Unit Testing | outofambit |
| Localization Tools | outofambit |
| Friendly Errors | outofambit |
@@ -87,371 +89,390 @@ We recognize all types of contributions. This project follows the [all-contribut
+ *
* function setup() {
* createButton('btn');
* createButton('2nd btn');
* createButton('3rd btn');
* let buttons = selectAll('button');
*
- * for (let i = 0; i < buttons.length; i++) {
- * buttons[i].size(100, 100);
+ * for (let i = 0; i < 3; i++) {
+ * buttons[i].size(100);
+ * buttons[i].position(0, i * 30);
* }
* }
*
- *
+ *
* // these are all valid calls to selectAll()
* let a = selectAll('.beep');
* a = selectAll('div');
@@ -142,9 +143,9 @@ p5.prototype._getContainer = function(p) {
* Helper function for getElement and getElements.
*/
p5.prototype._wrapElement = function(elt) {
- var children = Array.prototype.slice.call(elt.children);
+ const children = Array.prototype.slice.call(elt.children);
if (elt.tagName === 'INPUT' && elt.type === 'checkbox') {
- var converted = new p5.Element(elt, this);
+ let converted = new p5.Element(elt, this);
converted.checked = function() {
if (arguments.length === 0) {
return this.elt.checked;
@@ -178,11 +179,14 @@ p5.prototype._wrapElement = function(elt) {
* Event handlers are removed, and element is removed from the DOM.
* @method removeElements
* @example
- *
+ *
* function setup() {
* createCanvas(100, 100);
- * createDiv('this is some text');
- * createP('this is a paragraph');
+ * background('grey');
+ * let div = createDiv('this is some text');
+ * let p = createP('this is a paragraph');
+ * div.style('font-size', '16px');
+ * p.style('font-size', '16px');
* }
* function mousePressed() {
* removeElements(); // this will remove the div and p, not canvas
@@ -278,10 +282,14 @@ p5.Element.prototype.changed = function(fxn) {
* firing function will no longer fire.
* @chainable
* @example
- *
+ *
* // Open your console to see the output
* function setup() {
+ * createCanvas(100, 100);
+ * background('grey');
* let inp = createInput('');
+ * inp.position(0, 0);
+ * inp.size(100);
* inp.input(myInputEvent);
* }
*
@@ -302,9 +310,11 @@ p5.Element.prototype.input = function(fxn) {
* Helpers for create methods.
*/
function addElement(elt, pInst, media) {
- var node = pInst._userNode ? pInst._userNode : document.body;
+ const node = pInst._userNode ? pInst._userNode : document.body;
node.appendChild(elt);
- var c = media ? new p5.MediaElement(elt, pInst) : new p5.Element(elt, pInst);
+ const c = media
+ ? new p5.MediaElement(elt, pInst)
+ : new p5.Element(elt, pInst);
pInst._elements.push(c);
return c;
}
@@ -316,8 +326,10 @@ function addElement(elt, pInst, media) {
* @param {String} [html] inner HTML for element created
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createDiv('this is some text');
+ *
+ * let div = createDiv('this is some text');
+ * div.style('font-size', '16px');
+ * div.position(10, 0);
*
*/
p5.prototype.createDiv = function(html = '') {
@@ -334,8 +346,10 @@ p5.prototype.createDiv = function(html = '') {
* @param {String} [html] inner HTML for element created
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createP('this is some text');
+ *
+ * let p = createP('this is some text');
+ * p.style('font-size', '16px');
+ * p.position(10, 0);
*
*/
p5.prototype.createP = function(html = '') {
@@ -351,8 +365,9 @@ p5.prototype.createP = function(html = '') {
* @param {String} [html] inner HTML for element created
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createSpan('this is some text');
+ *
+ * let span = createSpan('this is some text');
+ * span.position(0, 0);
*
*/
p5.prototype.createSpan = function(html = '') {
@@ -370,11 +385,12 @@ p5.prototype.createSpan = function(html = '') {
* @param {String} alt alternate text to be used if image does not load. You can use also an empty string (`""`) if that an image is not intended to be viewed.
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createImg(
+ *
+ * let img = createImg(
* 'https://p5js.org/assets/img/asterisk-01.png',
* 'the p5 magenta asterisk'
* );
+ * img.position(0, -10);
*
*/
/**
@@ -387,9 +403,9 @@ p5.prototype.createSpan = function(html = '') {
*/
p5.prototype.createImg = function() {
p5._validateParameters('createImg', arguments);
- var elt = document.createElement('img');
- var args = arguments;
- var self;
+ const elt = document.createElement('img');
+ const args = arguments;
+ let self;
if (args.length > 1 && typeof args[1] === 'string') {
elt.alt = args[1];
}
@@ -401,7 +417,7 @@ p5.prototype.createImg = function() {
elt.addEventListener('load', function() {
self.width = elt.offsetWidth || elt.width;
self.height = elt.offsetHeight || elt.height;
- var last = args[args.length - 1];
+ const last = args[args.length - 1];
if (typeof last === 'function') last(self);
});
return self;
@@ -417,13 +433,14 @@ p5.prototype.createImg = function() {
* could be _blank, _self, _parent, _top.
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createA('http://p5js.org/', 'this is a link');
+ *
+ * let a = createA('http://p5js.org/', 'this is a link');
+ * a.position(0, 0);
*
*/
p5.prototype.createA = function(href, html, target) {
p5._validateParameters('createA', arguments);
- var elt = document.createElement('a');
+ const elt = document.createElement('a');
elt.href = href;
elt.innerHTML = html;
if (target) elt.target = target;
@@ -474,7 +491,7 @@ p5.prototype.createA = function(href, html, target) {
*/
p5.prototype.createSlider = function(min, max, value, step) {
p5._validateParameters('createSlider', arguments);
- var elt = document.createElement('input');
+ const elt = document.createElement('input');
elt.type = 'range';
elt.min = min;
elt.max = max;
@@ -497,13 +514,13 @@ p5.prototype.createSlider = function(min, max, value, step) {
* @param {String} [value] value of the button
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
+ *
* let button;
* function setup() {
* createCanvas(100, 100);
* background(0);
* button = createButton('click me');
- * button.position(19, 19);
+ * button.position(0, 0);
* button.mousePressed(changeBG);
* }
*
@@ -515,7 +532,7 @@ p5.prototype.createSlider = function(min, max, value, step) {
*/
p5.prototype.createButton = function(label, value) {
p5._validateParameters('createButton', arguments);
- var elt = document.createElement('button');
+ const elt = document.createElement('button');
elt.innerHTML = label;
if (value) elt.value = value;
return addElement(elt, this);
@@ -530,7 +547,7 @@ p5.prototype.createButton = function(label, value) {
* @param {boolean} [value] value of the checkbox; checked is true, unchecked is false
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
+ *
* let checkbox;
*
* function setup() {
@@ -549,14 +566,14 @@ p5.prototype.createButton = function(label, value) {
*/
p5.prototype.createCheckbox = function() {
p5._validateParameters('createCheckbox', arguments);
- var elt = document.createElement('div');
- var checkbox = document.createElement('input');
+ const elt = document.createElement('div');
+ const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
elt.appendChild(checkbox);
//checkbox must be wrapped in p5.Element before label so that label appears after
- var self = addElement(elt, this);
+ const self = addElement(elt, this);
self.checked = function() {
- var cb = self.elt.getElementsByTagName('input')[0];
+ const cb = self.elt.getElementsByTagName('input')[0];
if (cb) {
if (arguments.length === 0) {
return cb.checked;
@@ -573,10 +590,10 @@ p5.prototype.createCheckbox = function() {
return this;
};
if (arguments[0]) {
- var ran = Math.random()
+ const ran = Math.random()
.toString(36)
.slice(2);
- var label = document.createElement('label');
+ const label = document.createElement('label');
checkbox.setAttribute('id', ran);
label.htmlFor = ran;
self.value(arguments[0]);
@@ -779,10 +796,10 @@ p5.prototype.createSelect = function() {
*
* function setup() {
* radio = createRadio();
- * radio.option('apple', 1);
- * radio.option('bread', 2);
- * radio.option('juice', 3);
- * radio.style('width', '60px');
+ * radio.option(1, 'apple');
+ * radio.option(2, 'bread');
+ * radio.option(3, 'juice');
+ * radio.style('width', '30px');
* textAlign(CENTER);
* }
*
@@ -969,8 +986,8 @@ p5.prototype.createRadio = function() {
*/
p5.prototype.createColorPicker = function(value) {
p5._validateParameters('createColorPicker', arguments);
- var elt = document.createElement('input');
- var self;
+ const elt = document.createElement('input');
+ let self;
elt.type = 'color';
if (value) {
if (value instanceof p5.Color) {
@@ -1013,9 +1030,13 @@ p5.prototype.createColorPicker = function(value) {
* Needs a value to be specified first.
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
+ *
* function setup() {
+ * createCanvas(100, 100);
+ * background('grey');
* let inp = createInput('');
+ * inp.position(0, 0);
+ * inp.size(100);
* inp.input(myInputEvent);
* }
*
@@ -1256,7 +1277,7 @@ if (navigator.mediaDevices === undefined) {
if (navigator.mediaDevices.getUserMedia === undefined) {
navigator.mediaDevices.getUserMedia = function(constraints) {
// First get ahold of the legacy getUserMedia, if present
- var getUserMedia =
+ const getUserMedia =
navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
// Some browsers just don't implement it - return a rejected promise with an error
@@ -1301,12 +1322,12 @@ if (navigator.mediaDevices.getUserMedia === undefined) {
* stream has loaded
* @return {p5.Element} capture video p5.Element
* @example
- *
+ *
*
* let capture;
*
* function setup() {
- * createCanvas(480, 480);
+ * createCanvas(100, 100);
* capture = createCapture(VIDEO);
* capture.hide();
* }
@@ -1318,7 +1339,7 @@ if (navigator.mediaDevices.getUserMedia === undefined) {
*
*
*
- *
+ *
*
* function setup() {
* createCanvas(480, 120);
@@ -1338,7 +1359,7 @@ if (navigator.mediaDevices.getUserMedia === undefined) {
* }
*
*
- *
+ *
*
* let capture;
*
@@ -1419,13 +1440,15 @@ p5.prototype.createCapture = function() {
* @param {String} [content] html content to be inserted into the element
* @return {p5.Element} pointer to p5.Element holding created node
* @example
- *
- * createElement('h2', 'im an h2 p5.element!');
+ *
+ * let h5 = createElement('h5', 'im an h5 p5.element!');
+ * h5.style('color', '#00a1d3');
+ * h5.position(0, 0);
*
*/
p5.prototype.createElement = function(tag, content) {
p5._validateParameters('createElement', arguments);
- var elt = document.createElement(tag);
+ const elt = document.createElement(tag);
if (typeof content !== 'undefined') {
elt.innerHTML = content;
}
@@ -1626,18 +1649,18 @@ p5.Element.prototype.child = function(childNode) {
*
*/
p5.Element.prototype.center = function(align) {
- var style = this.elt.style.display;
- var hidden = this.elt.style.display === 'none';
- var parentHidden = this.parent().style.display === 'none';
- var pos = { x: this.elt.offsetLeft, y: this.elt.offsetTop };
+ const style = this.elt.style.display;
+ const hidden = this.elt.style.display === 'none';
+ const parentHidden = this.parent().style.display === 'none';
+ const pos = { x: this.elt.offsetLeft, y: this.elt.offsetTop };
if (hidden) this.show();
if (parentHidden) this.parent().show();
this.elt.style.display = 'block';
this.position(0, 0);
- var wOffset = Math.abs(this.parent().offsetWidth - this.elt.offsetWidth);
- var hOffset = Math.abs(this.parent().offsetHeight - this.elt.offsetHeight);
+ const wOffset = Math.abs(this.parent().offsetWidth - this.elt.offsetWidth);
+ const hOffset = Math.abs(this.parent().offsetHeight - this.elt.offsetHeight);
if (align === 'both' || align === undefined) {
this.position(
@@ -1764,7 +1787,7 @@ p5.Element.prototype.position = function() {
p5.Element.prototype._translate = function() {
this.elt.style.position = 'absolute';
// save out initial non-translate transform styling
- var transform = '';
+ let transform = '';
if (this.elt.style.transform) {
transform = this.elt.style.transform.replace(/translate3d\(.*\)/g, '');
transform = transform.replace(/translate[X-Z]?\(.*\)/g, '');
@@ -1795,7 +1818,7 @@ p5.Element.prototype._translate = function() {
/* Helper method called by p5.Element.style() */
p5.Element.prototype._rotate = function() {
// save out initial non-rotate transform styling
- var transform = '';
+ let transform = '';
if (this.elt.style.transform) {
transform = this.elt.style.transform.replace(/rotate3d\(.*\)/g, '');
transform = transform.replace(/rotate[X-Z]?\(.*\)/g, '');
@@ -1859,7 +1882,7 @@ p5.Element.prototype._rotate = function() {
* @chainable
*/
p5.Element.prototype.style = function(prop, val) {
- var self = this;
+ const self = this;
if (val instanceof p5.Color) {
val =
@@ -1882,9 +1905,9 @@ p5.Element.prototype.style = function(prop, val) {
return style;
} else {
// value set using `:` in a single line string
- var attrs = prop.split(';');
- for (var i = 0; i < attrs.length; i++) {
- var parts = attrs[i].split(':');
+ const attrs = prop.split(';');
+ for (let i = 0; i < attrs.length; i++) {
+ const parts = attrs[i].split(':');
if (parts[0] && parts[1]) {
this.elt.style[parts[0].trim()] = parts[1].trim();
}
@@ -1940,7 +1963,7 @@ p5.Element.prototype.attribute = function(attr, value) {
if (typeof value === 'undefined') {
return this.elt.firstChild.getAttribute(attr);
} else {
- for (var i = 0; i < this.elt.childNodes.length; i++) {
+ for (let i = 0; i < this.elt.childNodes.length; i++) {
this.elt.childNodes[i].setAttribute(attr, value);
}
}
@@ -1989,7 +2012,7 @@ p5.Element.prototype.removeAttribute = function(attr) {
(this.elt.firstChild.type === 'checkbox' ||
this.elt.firstChild.type === 'radio')
) {
- for (var i = 0; i < this.elt.childNodes.length; i++) {
+ for (let i = 0; i < this.elt.childNodes.length; i++) {
this.elt.childNodes[i].removeAttribute(attr);
}
}
@@ -2111,9 +2134,9 @@ p5.Element.prototype.size = function(w, h) {
if (arguments.length === 0) {
return { width: this.elt.offsetWidth, height: this.elt.offsetHeight };
} else {
- var aW = w;
- var aH = h;
- var AUTO = p5.prototype.AUTO;
+ let aW = w;
+ let aH = h;
+ const AUTO = p5.prototype.AUTO;
if (aW !== AUTO || aH !== AUTO) {
if (aW === AUTO) {
aW = h * this.width / this.height;
@@ -2122,9 +2145,9 @@ p5.Element.prototype.size = function(w, h) {
}
// set diff for cnv vs normal div
if (this.elt instanceof HTMLCanvasElement) {
- var j = {};
- var k = this.elt.getContext('2d');
- var prop;
+ const j = {};
+ const k = this.elt.getContext('2d');
+ let prop;
for (prop in k) {
j[prop] = k[prop];
}
@@ -2171,10 +2194,14 @@ p5.Element.prototype.remove = function() {
// stop all audios/videos and detach all devices like microphone/camera etc
// used as input/output for audios/videos.
if (this instanceof p5.MediaElement) {
- const tracks = this.elt.srcObject.getTracks();
- tracks.forEach(function(track) {
- track.stop();
- });
+ this.stop();
+ const sources = this.elt.srcObject;
+ if (sources !== null) {
+ const tracks = sources.getTracks();
+ tracks.forEach(track => {
+ track.stop();
+ });
+ }
}
// delete the reference in this._pInst._elements
@@ -2257,7 +2284,7 @@ p5.Element.prototype.drop = function(callback, fxn) {
if (!this._dragDisabled) {
this._dragDisabled = true;
- var preventDefault = function(evt) {
+ const preventDefault = function(evt) {
evt.preventDefault();
};
@@ -2280,11 +2307,11 @@ p5.Element.prototype.drop = function(callback, fxn) {
fxn.call(this, evt);
}
// A FileList
- var files = evt.dataTransfer.files;
+ const files = evt.dataTransfer.files;
// Load each one and trigger the callback
- for (var i = 0; i < files.length; i++) {
- var f = files[i];
+ for (let i = 0; i < files.length; i++) {
+ const f = files[i];
p5.File._load(f, callback);
}
},
@@ -2314,7 +2341,7 @@ p5.Element.prototype.drop = function(callback, fxn) {
p5.MediaElement = function(elt, pInst) {
p5.Element.call(this, elt, pInst);
- var self = this;
+ const self = this;
this.elt.crossOrigin = 'anonymous';
this._prevTime = 0;
@@ -2364,16 +2391,17 @@ p5.MediaElement = function(elt, pInst) {
*/
Object.defineProperty(self, 'src', {
get: function() {
- var firstChildSrc = self.elt.children[0].src;
- var srcVal = self.elt.src === window.location.href ? '' : self.elt.src;
- var ret = firstChildSrc === window.location.href ? srcVal : firstChildSrc;
+ const firstChildSrc = self.elt.children[0].src;
+ const srcVal = self.elt.src === window.location.href ? '' : self.elt.src;
+ const ret =
+ firstChildSrc === window.location.href ? srcVal : firstChildSrc;
return ret;
},
set: function(newValue) {
- for (var i = 0; i < self.elt.children.length; i++) {
+ for (let i = 0; i < self.elt.children.length; i++) {
self.elt.removeChild(self.elt.children[i]);
}
- var source = document.createElement('source');
+ const source = document.createElement('source');
source.src = newValue;
elt.appendChild(source);
self.elt.src = newValue;
@@ -2431,7 +2459,7 @@ p5.MediaElement.prototype.play = function() {
if (this.elt.currentTime === this.elt.duration) {
this.elt.currentTime = 0;
}
- var promise;
+ let promise;
if (this.elt.readyState > 1) {
promise = this.elt.play();
} else {
@@ -3170,7 +3198,7 @@ p5.MediaElement.prototype.onended = function(callback) {
* or an object from the p5.sound library
*/
p5.MediaElement.prototype.connect = function(obj) {
- var audioContext, mainOutput;
+ let audioContext, mainOutput;
// if p5.sound exists, same audio context
if (typeof p5.prototype.getAudioContext === 'function') {
@@ -3287,7 +3315,7 @@ p5.MediaElement.prototype.hideControls = function() {
// Cue inspired by JavaScript setTimeout, and the
// Tone.js Transport Timeline Event, MIT License Yotam Mann 2015 tonejs.org
-var Cue = function(callback, time, id, val) {
+const Cue = function(callback, time, id, val) {
this.callback = callback;
this.time = time;
this.id = id;
@@ -3325,7 +3353,7 @@ var Cue = function(callback, time, id, val) {
* //
* //
* function setup() {
- * noCanvas();
+ * createCanvas(200, 200);
*
* let audioEl = createAudio('assets/beat.mp3');
* audioEl.showControls();
@@ -3345,9 +3373,9 @@ var Cue = function(callback, time, id, val) {
*
*/
p5.MediaElement.prototype.addCue = function(time, callback, val) {
- var id = this._cueIDCounter++;
+ const id = this._cueIDCounter++;
- var cue = new Cue(callback, time, id, val);
+ const cue = new Cue(callback, time, id, val);
this._cues.push(cue);
if (!this.elt.ontimeupdate) {
@@ -3387,7 +3415,7 @@ p5.MediaElement.prototype.addCue = function(time, callback, val) {
*
*/
p5.MediaElement.prototype.removeCue = function(id) {
- for (var i = 0; i < this._cues.length; i++) {
+ for (let i = 0; i < this._cues.length; i++) {
if (this._cues[i].id === id) {
console.log(id);
this._cues.splice(i, 1);
@@ -3441,11 +3469,11 @@ p5.MediaElement.prototype.clearCues = function() {
// private method that checks for cues to be fired if events
// have been scheduled using addCue(callback, time).
p5.MediaElement.prototype._onTimeUpdate = function() {
- var playbackTime = this.time();
+ const playbackTime = this.time();
- for (var i = 0; i < this._cues.length; i++) {
- var callbackTime = this._cues[i].time;
- var val = this._cues[i].val;
+ for (let i = 0; i < this._cues.length; i++) {
+ const callbackTime = this._cues[i].time;
+ const val = this._cues[i].val;
if (this._prevTime < callbackTime && callbackTime <= playbackTime) {
// pass the scheduled callbackTime as parameter to the callback
@@ -3476,7 +3504,7 @@ p5.File = function(file, pInst) {
// Splitting out the file type into two components
// This makes determining if image or text etc simpler
- var typeList = file.type.split('/');
+ const typeList = file.type.split('/');
/**
* File type (image, text, etc.)
*
@@ -3512,9 +3540,9 @@ p5.File = function(file, pInst) {
};
p5.File._createLoader = function(theFile, callback) {
- var reader = new FileReader();
+ const reader = new FileReader();
reader.onload = function(e) {
- var p5file = new p5.File(theFile);
+ const p5file = new p5.File(theFile);
if (p5file.file.type === 'application/json') {
// Parse JSON and store the result in data
p5file.data = JSON.parse(e.target.result);
@@ -3539,7 +3567,7 @@ p5.File._load = function(f, callback) {
} else if (!/^(video|audio)\//.test(f.type)) {
p5.File._createLoader(f, callback).readAsDataURL(f);
} else {
- var file = new p5.File(f);
+ const file = new p5.File(f);
file.data = URL.createObjectURL(f);
callback(file);
}
diff --git a/src/image/loading_displaying.js b/src/image/loading_displaying.js
index 9f80ff8721..86f705857e 100644
--- a/src/image/loading_displaying.js
+++ b/src/image/loading_displaying.js
@@ -193,9 +193,14 @@ function _createGif(
loadGIFFrameIntoImage(j, gifReader);
const imageData = new ImageData(framePixels, pImg.width, pImg.height);
pImg.drawingContext.putImageData(imageData, 0, 0);
+ let frameDelay = frameInfo.delay;
+ // To maintain the default of 10FPS when frameInfo.delay equals to 0
+ if (frameDelay === 0) {
+ frameDelay = 10;
+ }
frames.push({
image: pImg.drawingContext.getImageData(0, 0, pImg.width, pImg.height),
- delay: frameInfo.delay * 10 //GIF stores delay in one-hundredth of a second, shift to ms
+ delay: frameDelay * 10 //GIF stores delay in one-hundredth of a second, shift to ms
});
}
diff --git a/src/io/files.js b/src/io/files.js
index 9971b7c9ad..6f56238092 100644
--- a/src/io/files.js
+++ b/src/io/files.js
@@ -411,8 +411,6 @@ p5.prototype.loadTable = function(path) {
}
}
- console.log('SEP IS ' + sep);
-
const t = new p5.Table();
const self = this;
@@ -1729,14 +1727,14 @@ p5.prototype.saveTable = function(table, filename, options) {
for (j = 0; j < table.rows[i].arr.length; j++) {
if (j < table.rows[i].arr.length - 1) {
//double quotes should be inserted in csv only if contains comma separated single value
- if (ext === 'csv' && table.rows[i].arr[j].includes(',')) {
+ if (ext === 'csv' && String(table.rows[i].arr[j]).includes(',')) {
pWriter.write('"' + table.rows[i].arr[j] + '"' + sep);
} else {
pWriter.write(table.rows[i].arr[j] + sep);
}
} else {
//double quotes should be inserted in csv only if contains comma separated single value
- if (ext === 'csv' && table.rows[i].arr[j].includes(',')) {
+ if (ext === 'csv' && String(table.rows[i].arr[j]).includes(',')) {
pWriter.write('"' + table.rows[i].arr[j] + '"');
} else {
pWriter.write(table.rows[i].arr[j]);
diff --git a/src/math/calculation.js b/src/math/calculation.js
index 59c109136b..bd7bd7c15e 100644
--- a/src/math/calculation.js
+++ b/src/math/calculation.js
@@ -501,7 +501,6 @@ p5.prototype.map = function(n, start1, stop1, start2, stop2, withinBounds) {
* @return {Number}
*/
p5.prototype.max = function(...args) {
- p5._validateParameters('max', args);
if (args[0] instanceof Array) {
return Math.max.apply(null, args[0]);
} else {
@@ -550,7 +549,6 @@ p5.prototype.max = function(...args) {
* @return {Number}
*/
p5.prototype.min = function(...args) {
- p5._validateParameters('min', args);
if (args[0] instanceof Array) {
return Math.min.apply(null, args[0]);
} else {
diff --git a/src/math/p5.Vector.js b/src/math/p5.Vector.js
index e4e592b353..f7ac8bc1b4 100644
--- a/src/math/p5.Vector.js
+++ b/src/math/p5.Vector.js
@@ -1213,6 +1213,20 @@ p5.Vector.prototype.dist = function dist(v) {
* // [0.4454354, 0.8908708, 0.089087084]
*
*
+ *
+ *
+ *
+ * // Static method
+ * let v_initial = createVector(10, 20, 2);
+ * // v_initial has components [10.0, 20.0, 2.0]
+ * let v_normalized = p5.Vector.normalize(v_initial);
+ * print(v_normalized);
+ * // returns a new vector with components set to
+ * // [0.4454354, 0.8908708, 0.089087084]
+ * // v_initial remains unchanged
+ *
+ *
+ *
*
*
* function draw() {
@@ -1440,6 +1454,31 @@ p5.Vector.prototype.heading = function heading() {
return h;
};
+/**
+ * Rotate the vector to a specific angle (only 2D vectors), magnitude remains the
+ * same
+ *
+ * @method setHeading
+ * @param {number} angle the angle of rotation
+ * @chainable
+ * @example
+ *
+ *
+ * let v = createVector(10.0, 20.0);
+ * // result of v.heading() is 1.1071487177940904
+ * v.setHeading(Math.PI);
+ * // result of v.heading() is now 3.141592653589793
+ *
+ *
+ */
+
+p5.Vector.prototype.setHeading = function setHeading(a) {
+ let m = this.mag();
+ this.x = m * Math.cos(a);
+ this.y = m * Math.sin(a);
+ return this;
+};
+
/**
* Rotate the vector by an angle (only 2D vectors), magnitude remains the
* same
@@ -1457,6 +1496,19 @@ p5.Vector.prototype.heading = function heading() {
*
*
*
+ *
+ *
+ * // static function implementation
+ * let v = createVector(10.0, 20.0);
+ * // v has components [10.0, 20.0, 0.0]
+ * let rotated_v = p5.Vector.rotate(v, HALF_PI);
+ * console.log(rotated_v);
+ * // rotated_v's components are set to [-20.0, 9.999999, 0.0]
+ * console.log(v);
+ * // v's components remains the same (i.e, [10.0, 20.0, 0.0])
+ *
+ *
+ *
*
*
* let angle = 0;
@@ -2113,6 +2165,33 @@ p5.Vector.mult = function mult(v, n, target) {
return target;
};
+/**
+ * Rotates the vector (only 2D vectors) by the given angle, magnitude remains the same and returns a new vector.
+ */
+
+/**
+ * @method rotate
+ * @static
+ * @param {p5.Vector} v
+ * @param {Number} angle
+ * @param {p5.Vector} [target] the vector to receive the result (Optional)
+ */
+p5.Vector.rotate = function rotate(v, a, target) {
+ if (arguments.length === 2) {
+ target = v.copy();
+ } else {
+ if (!(target instanceof p5.Vector)) {
+ p5._friendlyError(
+ 'The target parameter should be of type p5.Vector',
+ 'p5.Vector.rotate'
+ );
+ }
+ target.set(v);
+ }
+ target.rotate(a);
+ return target;
+};
+
/**
* Divides a vector by a scalar and returns a new vector.
*/
@@ -2238,11 +2317,15 @@ p5.Vector.lerp = function lerp(v1, v2, amt, target) {
return target;
};
+/**
+ * Calculates the magnitude (length) of the vector and returns the result as
+ * a float (this is simply the equation sqrt(x\*x + y\*y + z\*z).)
+ */
/**
* @method mag
+ * @static
* @param {p5.Vector} vecT the vector to return the magnitude of
* @return {Number} the magnitude of vecT
- * @static
*/
p5.Vector.mag = function mag(vecT) {
const x = vecT.x,
@@ -2252,4 +2335,29 @@ p5.Vector.mag = function mag(vecT) {
return Math.sqrt(magSq);
};
+/**
+ * Normalize the vector to length 1 (make it a unit vector).
+ */
+/**
+ * @method normalize
+ * @static
+ * @param {p5.Vector} v the vector to normalize
+ * @param {p5.Vector} [target] the vector to receive the result (Optional)
+ * @return {p5.Vector} v normalized to a length of 1
+ */
+p5.Vector.normalize = function normalize(v, target) {
+ if (arguments.length < 2) {
+ target = v.copy();
+ } else {
+ if (!(target instanceof p5.Vector)) {
+ p5._friendlyError(
+ 'The target parameter should be of type p5.Vector',
+ 'p5.Vector.normalize'
+ );
+ }
+ target.set(v);
+ }
+ return target.normalize();
+};
+
export default p5.Vector;
diff --git a/src/typography/p5.Font.js b/src/typography/p5.Font.js
index c6b4bc9ffa..d57036dbdf 100644
--- a/src/typography/p5.Font.js
+++ b/src/typography/p5.Font.js
@@ -130,17 +130,17 @@ p5.Font.prototype.textBounds = function(str, x = 0, y = 0, fontSize, opts) {
maxX[lineCount] = Math.max.apply(null, xCoords[lineCount]);
}
- var finalMaxX = 0;
- for (var i = 0; i <= lineCount; i++) {
+ let finalMaxX = 0;
+ for (let i = 0; i <= lineCount; i++) {
minX[i] = Math.min.apply(null, xCoords[i]);
maxX[i] = Math.max.apply(null, xCoords[i]);
- var lineLength = maxX[i] - minX[i];
+ const lineLength = maxX[i] - minX[i];
if (lineLength > finalMaxX) {
finalMaxX = lineLength;
}
}
- var finalMinX = Math.min.apply(null, minX);
+ const finalMinX = Math.min.apply(null, minX);
minY = Math.min.apply(null, yCoords);
maxY = Math.max.apply(null, yCoords);
diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js
index 3c17821f4c..5f91b564f0 100644
--- a/src/webgl/3d_primitives.js
+++ b/src/webgl/3d_primitives.js
@@ -1233,24 +1233,60 @@ p5.RendererGL.prototype.rect = function(args) {
};
// prettier-ignore
-p5.RendererGL.prototype.quad = function(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) {
+p5.RendererGL.prototype.quad = function(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, detailX, detailY) {
+ if (typeof detailX === 'undefined') {
+ detailX = 2;
+ }
+ if (typeof detailY === 'undefined') {
+ detailY = 2;
+ }
+
const gId =
- `quad|${x1}|${y1}|${z1}|${x2}|${y2}|${z2}|${x3}|${y3}|${z3}|${x4}|${y4}|${z4}`;
+ `quad|${x1}|${y1}|${z1}|${x2}|${y2}|${z2}|${x3}|${y3}|${z3}|${x4}|${y4}|${z4}|${detailX}|${detailY}`;
+
if (!this.geometryInHash(gId)) {
- const _quad = function() {
- this.vertices.push(new p5.Vector(x1, y1, z1));
- this.vertices.push(new p5.Vector(x2, y2, z2));
- this.vertices.push(new p5.Vector(x3, y3, z3));
- this.vertices.push(new p5.Vector(x4, y4, z4));
- this.uvs.push(0, 0, 1, 0, 1, 1, 0, 1);
- this.strokeIndices = [[0, 1], [1, 2], [2, 3], [3, 0]];
- };
- const quadGeom = new p5.Geometry(2, 2, _quad);
+ const quadGeom = new p5.Geometry(detailX, detailY, function() {
+ //algorithm adapted from c++ to js
+ //https://stackoverflow.com/questions/16989181/whats-the-correct-way-to-draw-a-distorted-plane-in-opengl/16993202#16993202
+ let xRes = 1.0 / (this.detailX - 1);
+ let yRes = 1.0 / (this.detailY - 1);
+ for (let y = 0; y < this.detailY; y++) {
+ for (let x = 0; x < this.detailX; x++) {
+ let pctx = x * xRes;
+ let pcty = y * yRes;
+
+ let linePt0x = (1 - pcty) * x1 + pcty * x4;
+ let linePt0y = (1 - pcty) * y1 + pcty * y4;
+ let linePt0z = (1 - pcty) * z1 + pcty * z4;
+ let linePt1x = (1 - pcty) * x2 + pcty * x3;
+ let linePt1y = (1 - pcty) * y2 + pcty * y3;
+ let linePt1z = (1 - pcty) * z2 + pcty * z3;
+
+ let ptx = (1 - pctx) * linePt0x + pctx * linePt1x;
+ let pty = (1 - pctx) * linePt0y + pctx * linePt1y;
+ let ptz = (1 - pctx) * linePt0z + pctx * linePt1z;
+
+ this.vertices.push(new p5.Vector(ptx, pty, ptz));
+ this.uvs.push([pctx, pcty]);
+ }
+ }
+ });
+
+ quadGeom.faces = [];
+ for(let y = 0; y < detailY-1; y++){
+ for(let x = 0; x < detailX-1; x++){
+ let pt0 = x + y * detailX;
+ let pt1 = (x + 1) + y * detailX;
+ let pt2 = (x + 1) + (y + 1) * detailX;
+ let pt3 = x + (y + 1) * detailX;
+ quadGeom.faces.push([pt0, pt1, pt2]);
+ quadGeom.faces.push([pt0, pt2, pt3]);
+ }
+ }
quadGeom
.computeNormals()
._makeTriangleEdges()
._edgesToVertices();
- quadGeom.faces = [[0, 1, 2], [2, 3, 0]];
this.createBuffers(gId, quadGeom);
}
this.drawBuffers(gId);
diff --git a/src/webgl/loading.js b/src/webgl/loading.js
index 413ebf972d..78e19145c2 100755
--- a/src/webgl/loading.js
+++ b/src/webgl/loading.js
@@ -222,8 +222,10 @@ function parseObj(model, lines) {
loadedVerts[tokens[0]].push(vertex);
} else if (tokens[0] === 'vt') {
// Check if this line describes a texture coordinate.
- // It will have two numeric parameters.
- const texVertex = [parseFloat(tokens[1]), parseFloat(tokens[2])];
+ // It will have two numeric parameters U and V (W is omitted).
+ // Because of WebGL texture coordinates rendering behaviour, the V
+ // coordinate is inversed.
+ const texVertex = [parseFloat(tokens[1]), 1 - parseFloat(tokens[2])];
loadedVerts[tokens[0]].push(texVertex);
} else if (tokens[0] === 'f') {
// Check if this line describes a face.
diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js
index deb7b9880c..af344e1ca5 100644
--- a/src/webgl/p5.Camera.js
+++ b/src/webgl/p5.Camera.js
@@ -882,13 +882,17 @@ p5.Camera.prototype.camera = function(
this.eyeY = eyeY;
this.eyeZ = eyeZ;
- this.centerX = centerX;
- this.centerY = centerY;
- this.centerZ = centerZ;
+ if (typeof centerX !== 'undefined') {
+ this.centerX = centerX;
+ this.centerY = centerY;
+ this.centerZ = centerZ;
+ }
- this.upX = upX;
- this.upY = upY;
- this.upZ = upZ;
+ if (typeof upX !== 'undefined') {
+ this.upX = upX;
+ this.upY = upY;
+ this.upZ = upZ;
+ }
const local = this._getLocalAxes();
diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js
index bbe89a842d..c0fdc2b9ba 100755
--- a/src/webgl/p5.RendererGL.js
+++ b/src/webgl/p5.RendererGL.js
@@ -1310,7 +1310,10 @@ p5.RendererGL.prototype._setPointUniforms = function(pointShader) {
pointShader.setUniform('uMaterialColor', this.curStrokeColor);
// @todo is there an instance where this isn't stroke weight?
// should be they be same var?
- pointShader.setUniform('uPointSize', this.pointSize);
+ pointShader.setUniform(
+ 'uPointSize',
+ this.pointSize * this._pInst._pixelDensity
+ );
};
/* Binds a buffer to the drawing context
diff --git a/tasks/test/mocha-chrome.js b/tasks/test/mocha-chrome.js
index fe02a99873..b6903b3b90 100644
--- a/tasks/test/mocha-chrome.js
+++ b/tasks/test/mocha-chrome.js
@@ -16,7 +16,7 @@ module.exports = function(grunt) {
// Launch Chrome in headless mode
const browser = await puppeteer.launch({
headless: true,
- args: ['--no-sandbox']
+ args: ['--no-sandbox', '--disable-setuid-sandbox']
});
try {
diff --git a/test/unit/core/error_helpers.js b/test/unit/core/error_helpers.js
index b29a8d80b1..47e6a29d0e 100644
--- a/test/unit/core/error_helpers.js
+++ b/test/unit/core/error_helpers.js
@@ -391,7 +391,7 @@ suite('Error Helpers', function() {
const logMsg = help(new ReferenceError('MouseX is not defined'));
assert.match(
logMsg,
- /It seems that you may have accidently written "MouseX"/
+ /It seems that you may have accidentally written "MouseX"/
);
assert.match(logMsg, /mouseX/);
});
@@ -400,7 +400,7 @@ suite('Error Helpers', function() {
const logMsg = help(new ReferenceError('colour is not defined'));
assert.match(
logMsg,
- /It seems that you may have accidently written "colour"/
+ /It seems that you may have accidentally written "colour"/
);
assert.match(logMsg, /color/);
});
@@ -411,7 +411,7 @@ suite('Error Helpers', function() {
const logMsg = help(new ReferenceError('strok is not defined'));
assert.match(
logMsg,
- /It seems that you may have accidently written "strok"/
+ /It seems that you may have accidentally written "strok"/
);
assert.match(logMsg, /stroke/);
assert.match(logMsg, /STROKE/);
@@ -422,7 +422,7 @@ suite('Error Helpers', function() {
const logMsg = help(new ReferenceError('RandomGossian is not defined'));
assert.match(
logMsg,
- /It seems that you may have accidently written "RandomGossian"/
+ /It seems that you may have accidentally written "RandomGossian"/
);
assert.match(logMsg, /randomGaussian/);
});
@@ -459,7 +459,7 @@ suite('Error Helpers', function() {
assert.strictEqual(log.length, 1, 'One message is displayed');
assert.match(
log[0],
- /It seems that you may have accidently written preLoad instead of preload/
+ /It seems that you may have accidentally written preLoad instead of preload/
);
}
);
@@ -492,7 +492,7 @@ suite('Error Helpers', function() {
assert.strictEqual(log.length, 1);
assert.match(
log[0],
- /It seems that you may have accidently written DRAW instead of draw/
+ /It seems that you may have accidentally written DRAW instead of draw/
);
});
}
diff --git a/test/unit/math/p5.Vector.js b/test/unit/math/p5.Vector.js
index 6431b0f778..7c317c4822 100644
--- a/test/unit/math/p5.Vector.js
+++ b/test/unit/math/p5.Vector.js
@@ -18,6 +18,15 @@ suite('p5.Vector', function() {
});
var v;
+ suite('setHeading', function() {
+ setup(function() {
+ v = myp5.createVector(1, 1);
+ v.setHeading(1);
+ });
+ test('should have heading() value of 1', function() {
+ assert.closeTo(v.heading(), 1, 0.001);
+ });
+ });
suite('p5.prototype.createVector()', function() {
setup(function() {
v = myp5.createVector();
@@ -859,18 +868,16 @@ suite('p5.Vector', function() {
});
suite('normalize', function() {
- setup(function() {
- v.x = 1;
- v.y = 1;
- v.z = 1;
- });
+ suite('v.normalize()', function() {
+ setup(function() {
+ v = myp5.createVector(1, 1, 1);
+ });
- test('should return the same object', function() {
- expect(v.normalize()).to.eql(v);
- });
+ test('should return the same object', function() {
+ expect(v.normalize()).to.eql(v);
+ });
- suite('with unit vector', function() {
- test('should not change the vector', function() {
+ test('unit vector should not change values', function() {
v.x = 1;
v.y = 0;
v.z = 0;
@@ -879,10 +886,8 @@ suite('p5.Vector', function() {
expect(v.y).to.eql(0);
expect(v.z).to.eql(0);
});
- });
- suite('with 2,2,1', function() {
- test('should normalize to 0.66,0.66,0.33', function() {
+ test('2,2,1 should normalize to ~0.66,0.66,0.33', function() {
v.x = 2;
v.y = 2;
v.z = 1;
@@ -892,6 +897,38 @@ suite('p5.Vector', function() {
expect(v.z).to.be.closeTo(0.3333, 0.01);
});
});
+
+ suite('p5.Vector.normalize(v)', function() {
+ var res;
+ setup(function() {
+ v = myp5.createVector(1, 0, 0);
+ res = p5.Vector.normalize(v);
+ });
+
+ test('should not be undefined', function() {
+ expect(res).to.not.eql(undefined);
+ });
+
+ test('should not return same object v', function() {
+ expect(res).to.not.equal(v);
+ });
+
+ test('unit vector 1,0,0 should normalize to 1,0,0', function() {
+ expect(res.x).to.eql(1);
+ expect(res.y).to.eql(0);
+ expect(res.z).to.eql(0);
+ });
+
+ test('2,2,1 should normalize to ~0.66,0.66,0.33', function() {
+ v.x = 2;
+ v.y = 2;
+ v.z = 1;
+ res = p5.Vector.normalize(v);
+ expect(res.x).to.be.closeTo(0.6666, 0.01);
+ expect(res.y).to.be.closeTo(0.6666, 0.01);
+ expect(res.z).to.be.closeTo(0.3333, 0.01);
+ });
+ });
});
suite('limit', function() {
diff --git a/translations/en/translation.json b/translations/en/translation.json
index dfae559192..ff45b2c26d 100644
--- a/translations/en/translation.json
+++ b/translations/en/translation.json
@@ -1,7 +1,7 @@
{
"fes": {
"autoplay": "The media that tried to play (with '{{src}}') wasn't allowed to by this browser, most likely due to the browser's autoplay policy. Check out {{link}} for more information about why.",
- "checkUserDefinedFns": "It seems that you may have accidently written {{name}} instead of {{actualName}}.\n\nPlease correct it if it's not intentional.",
+ "checkUserDefinedFns": "It seems that you may have accidentally written {{name}} instead of {{actualName}}.\n\nPlease correct it if it's not intentional.",
"fileLoadError": {
"bytes": "It looks like there was a problem loading your file. {{suggestion}}",
"font": "It looks like there was a problem loading your font. {{suggestion}}",
@@ -37,8 +37,8 @@
},
"libraryError": "An error with message \"{{error}}\" occured inside the p5js library when {{func}} was called {{location}}\n\nIf not stated otherwise, it might be an issue with the arguments passed to {{func}}.",
"location": "(on line {{line}} in {{file}} [{{location}}])",
- "misspelling": "It seems that you may have accidently written \"{{name}}\" instead of \"{{actualName}}\" {{location}}.\n\nPlease correct it to {{actualName}} if you wish to use the {{type}} from p5.js",
- "misspelling_plural": "It seems that you may have accidently written \"{{name}}\" {{location}}.\n\nYou may have meant one of the following:\n{{suggestions}}",
+ "misspelling": "It seems that you may have accidentally written \"{{name}}\" instead of \"{{actualName}}\" {{location}}.\n\nPlease correct it to {{actualName}} if you wish to use the {{type}} from p5.js",
+ "misspelling_plural": "It seems that you may have accidentally written \"{{name}}\" {{location}}.\n\nYou may have meant one of the following:\n{{suggestions}}",
"misusedTopLevel": "Did you just try to use p5.js's {{symbolName}} {{symbolType}}? If so, you may want to move it into your sketch's setup() function.\n\nFor more details, see: {{link}}",
"positions": {
"p_1": "first",
@@ -58,4 +58,4 @@
"welcome": "Welcome! This is your friendly debugger. To turn me off, switch to using p5.min.js.",
"wrongPreload": "An error with message \"{{error}}\" occured inside the p5js library when \"{{func}}\" was called {{location}}.\n\nIf not stated otherwise, it might be due to \"{{func}}\" being called from preload. Nothing besides load calls (loadImage, loadJSON, loadFont, loadStrings, etc.) should be inside the preload function."
}
-}
+}
\ No newline at end of file