Public
Edited
Apr 21, 2024
Insert cell
Insert cell
import {p5} from "@tmcw/p5"
Insert cell
viewof backgroundColor = Inputs.range([0, 255], {label: "Background Color", step: 1})
Insert cell
viewof ellipseSize = Inputs.range([0, 100], {label: "Ellipse Size", step: 1})
Insert cell
p5(sketch)
Insert cell
function sketch(p){
p.setup = () => {
p.createCanvas(400, 400);
p.background(backgroundColor);
};
p.draw = () => {
if (p.mouseIsPressed) p.fill(0);
else p.fill(255);
p.ellipse(p.mouseX, p.mouseY, ellipseSize, ellipseSize);
};
}
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