xxxxxxxxxx
32
function setup() {
createCanvas(700, 700);
background(247, 241, 219);
stroke(242, 186, 170, 50);
}
function draw() {
translate(width / 2, height / 2);
var circleResolution = map(mouseY, 0, height, 2, 5, true);
var radius = mouseX - width / 2;
var angle = TWO_PI / circleResolution;
beginShape();
for (var i = 0; i <= circleResolution; i++) {
var x = cos(angle * i) * radius;
var y = sin(angle * i) * radius;
line(0, 0, x, y)
}
endShape(CLOSE);
}
function keyReleased() {
if (keyCode == DELETE || keyCode == BACKSPACE) background(247, 241, 219);
stroke(242, 186, 170, 50);
if (key == 's' || key == 'S') saveCanvas();
if (key == '1') stroke(242, 186, 170, 50);
if (key == '2') stroke(100, 100, 100, 10);
if (key == '3') stroke(197, 196, 128, 25);
}