Open GoToLoop opened 8 years ago
Found a workaround! But it's still a redundant & slower boilerplate; given we 1st need to create an instance and only then access its constructor: :disappointed: createVector().constructor.random3D()
const VECS = 5,
RANGE = 10,
vecs = Array(VECS);
function setup() {
noCanvas();
for (let i = 0; i < VECS; vecs[i++] = createVector().constructor.random3D().mult(RANGE));
for (let i in vecs) print(`${i} -> ${vecs[i]}`);
}
http://p5ide.HerokuApp.com/editor#?sketch=574bd0ad02c8c203008bbfdb
Found out another hackish workaround for http://p5ide.HerokuApp.com/editor:
window.p5 = _renderer._pInst.constructor;
Link for the latest sketch: http://p5ide.HerokuApp.com/editor#?sketch=5751b1d4591f900300aaf9de
Hope constructor p5 gets back to the p5js WebIDE soon, so we don't need those hacks anymore. :pray:
W/o p5 there's no apparent way to invoke
static
methods like p5.Vector.Random3D(): :crying_cat_face: http://p5js.org/reference/#/p5.Vector/random3D