Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/friendly_errors/fes_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ function fesCore(p5, fn){
* @param {Number|String} [color] CSS color code
*/
p5._friendlyError = function(message, func, color) {
if (p5.disableFriendlyErrors) return;
p5._report(message, func, color);
};

Expand Down
9 changes: 9 additions & 0 deletions src/math/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function math(p5, fn) {
* This allows for flexibility in representing vectors in higher-dimensional
* spaces.
*
* Calling `createVector()` **with no arguments** is **deprecated** and will emit
* a friendly warning. Use `createVector(0)`, `createVector(0, 0)`, or
* `createVector(0, 0, 0)` instead.
*
* <a href="#/p5.Vector">p5.Vector</a> objects are often used to program
* motion because they simplify the math. For example, a moving ball has a
* position and a velocity. Position describes where the ball is in space. The
Expand Down Expand Up @@ -96,6 +100,11 @@ function math(p5, fn) {
* </div>
*/
fn.createVector = function (x, y, z) {
if (arguments.length === 0) {
p5._friendlyError(
'In 1.x, createVector() was a shortcut for createVector(0, 0, 0). In 2.x, p5.js has vectors of any dimension, so you must provide your desired number of zeros. Use createVector(0, 0) for a 2D vector and createVector(0, 0, 0) for a 3D vector.'
);
}
if (this instanceof p5) {
return new p5.Vector(
this._fromRadians.bind(this),
Expand Down
Loading