21 lines
582 B
JavaScript
21 lines
582 B
JavaScript
|
const sketch = p => {
|
||
|
p.setup = () => {
|
||
|
const sketchContainer = document.querySelector('#sketch');
|
||
|
const canvasWidth = parseFloat(getComputedStyle(sketchContainer).width);
|
||
|
let canvas = p.createCanvas(canvasWidth, canvasWidth);
|
||
|
canvas.canvas.removeAttribute('style');
|
||
|
sketchContainer.appendChild(canvas.canvas);
|
||
|
|
||
|
p.pixelDensity(p.displayDensity());
|
||
|
};
|
||
|
|
||
|
p.draw = () => {
|
||
|
p.background(255);
|
||
|
p.strokeWeight(4);
|
||
|
p.stroke(0, 0, 255);
|
||
|
p.circle(100, 100, 100);
|
||
|
};
|
||
|
};
|
||
|
|
||
|
new p5(sketch, 'sketch');
|