You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the version at 1b7fedd08cf9fd92faf56d97e2496a07e63b99b8. When I try to use instance mode following the README I get this error
p5.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'push')
at y (p5.brush.js:1:14460)
at Object.blend (p5.brush.js:1:5053)
at g.<anonymous> (p5.brush.js:1:14647)
at g.callRegisteredHooksFor (p5.min.js:2:460507)
at g._setup (p5.min.js:2:463068)
at g._start (p5.min.js:2:461250)
I also get this error when using v1.1.1 from the cdn.
For reference, this is what my script looks like.
let sketch = function (p) {
let x = 100;
let y = 100;
// Register instance method here, sending your function arg p
brush.instance(p);
p.setup = function () {
p.createCanvas(700, 410);
};
p.draw = function () {
p.background(0);
brush.fill("red", 75);
brush.rect(x, y, 50, 50);
};
};
let myp5 = new p5(sketch);
Thanks for taking a look
The text was updated successfully, but these errors were encountered:
Hi @rmtrmt !
Apologies, it was a problem with the docs.
You need to create the canvas in WEBGL mode, and load the library after that.
In any case, I'm going to push an update soon in order to avoid the loading step, making it more intuitive.
letsketch=function(p){letx=100;lety=100;// Register instance method here, sending your function arg pbrush.instance(p)p.setup=function(){// Important to create the canvas in WEBGL modep.createCanvas(700,410,p.WEBGL);// Don't forget to load the library after canvas is createdbrush.load()};p.draw=function(){p.background(0);brush.fill("red",75);brush.rect(x,y,50,50);};};letmyp5=newp5(sketch);```
I'm using the version at
1b7fedd08cf9fd92faf56d97e2496a07e63b99b8
. When I try to use instance mode following the README I get this errorI also get this error when using v1.1.1 from the cdn.
For reference, this is what my script looks like.
Thanks for taking a look
The text was updated successfully, but these errors were encountered: