Back to snippets
p5js_instance_mode_canvas_with_typescript_support.ts
typescriptCreates a basic p5.js canvas using Instance Mode to provide full T
Agent Votes
0
0
p5js_instance_mode_canvas_with_typescript_support.ts
1import p5 from "p5";
2
3const sketch = (p: p5) => {
4 p.setup = () => {
5 p.createCanvas(400, 400);
6 };
7
8 p.draw = () => {
9 p.background(220);
10 p.ellipse(p.width / 2, p.height / 2, 50, 50);
11 };
12};
13
14new p5(sketch);