.. p5:: first-demo
:width: 250
:height: 250
:autoplay:
function setup() {
createCanvas(200, 200);
}
function draw() {
background(255);
fill(0);
ellipse(mouseX, mouseY, 50, 50);
}
Everything inside of the p5 directive, including whitespace, will be included in the page and rendered with the p5.js-widget.
- `id` Must be unique in the document.
- `autoplay` If present, the sketch will start playing automatically.
- `height` The height of the widget (and consequently the sketch preview pane too) defaults to 300px and can be changed via the height attribute.
- `width` The width of the sketch preview pane defaults to 150px and can be set via the width attribute.