p5(sketch => {
sketch.setup = function() {
sketch.createCanvas(width, height);
sketch.colorMode(sketch.HSB, 360, 100, 100, 50);
sketch.noFill();
sketch.rect(0, 0, width, height);
};
sketch.draw = function() {
sketch.background(255, 2);
const thisSecond = new Date().getSeconds() / 2;
const circleResolution = sketch.map(thisSecond, 0, 30, 2, 60);
const radius = sketch.map(thisSecond, 0.5, 30, 0.5, height / 2) + Math.random();
const angle = sketch.TWO_PI / circleResolution;
sketch.strokeWeight(thisSecond / 30);
sketch.translate(width / 2, height / 2);
sketch.beginShape();
for (var i = 0; i <= circleResolution; i++) {
const x = sketch.cos(180 - angle * i) * radius;
const y = sketch.sin(180 - angle * i) * radius;
sketch.vertex(x, y);
}
sketch.endShape(sketch.CLOSE);
}
})