xxxxxxxxxx
55
let radius;
let angle;
var step; //distance between steps in radians
let redValue, greenValue, blueValue;
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
radius = 70; // Distance from enter
angle = 0; // Current angle around circle
step = TWO_PI / random(1); // How many steps around circle
redValue = random(256);
greenValue = random(256);
blueValue = random(256);
maxDeviation = random(128);
frameRate(15);
console.log(step);
// console.log()
}
function randomDeviation() {
return random(maxDeviation * -1, maxDeviation);
}
function draw() {
translate(width / 2, height / 2);
// Make the center of the screen the new (0, 0)
radius += 1;
// Convert polar coordinates to cartesian coordinates
var x = radius * sin(angle);
var y = radius * cos(angle);
let randomColor = color(
redValue + randomDeviation(),
greenValue + randomDeviation(),
blueValue + randomDeviation()
);
stroke(randomColor);
strokeWeight(1);
// fill(randomColor);
noFill();
// Draw a circle at each point around circle
ellipse(x, y, radius);
// Move to next angle
angle = angle + step;
}