Public
Edited
Mar 27
Insert cell
Insert cell
Insert cell
Insert cell
{
if (window.p_inst !== undefined) {
window.p_inst.remove();
}

window.p_inst = new P5(
(p) => {
p.setup = setup(p);
p.draw = draw(p);
},
document.querySelector("#view"),
true
);

return "Succeed";
}
Insert cell
function setup(p) {
return () => {
p.createCanvas(900, 640, p.WEBGL);
p.angleMode(p.DEGREES);
};
}
Insert cell
function draw(p) {
return () => {
p.background(0);

p.noFill();
p.stroke("orange");
p.strokeWeight(1);
p.circle(0, 0, 50);

p.stroke("green");
p.strokeWeight(2);
p.circle(100, 100, 50);
};
}
Insert cell
Insert cell
P5 = require("p5")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more