Martinibomb
"window" global issues using the p5.js library in a Deno / Fresh project
Hmm thank you, that seems to have worked, but I ended up getting the document warning too and decided to just do the whole import exclusively in the browser like this:
useEffect(() => {
import("p5").then((p5) => {
console.log("p5", p5);
const sketch = (p: p5) => {
p.setup = () => {
p.createCanvas(400, 400);
};
p.draw = () => {
p.background(220);
p.textSize(32);
p.text("Hello World", 100, 100);
};
};
new p5.default(sketch);
});
}, []);
3 replies