sketch.jsconst sketch = p => {
p.setup = () => {
//キャンバスを作成
const canvas = p.createCanvas(600,425);
canvas.id = '__P5sc__';
//背景色
p.background('#eee');
p.stroke('#aaa');
}
p.draw = () => {
if (p.mouseIsPressed) {
p.fill(0,0,0,10);
} else {
p.fill('#fff');
}
p.triangle(p.mouseX, p.mouseY, p.mouseX+15, p.mouseY+30, p.mouseX+-15, p.mouseY+30);
}
}
new p5(sketch, 'editor');