xxxxxxxxxx
38
/*
Based on source:
Aesthetic Programming by Winnie Soon & Geoff Cox
https://www.aesthetic-programming.net/pages/3-infinite-loops.html#setup-70191
LICENSE
[Aesthetic Programming] is an open access book, licensed under the Creative Commons Attribution By Attribution Share Alike License. Under this license, authors allow anyone to download, reuse, reprint, modify, distribute, and/or copy their work so long as the authors and source are cited and resulting derivative works are licensed under the same or similar license. No permission is required from the authors or the publisher. Statutory fair use and other rights are in no way affected by the above. Read more about the license at https://creativecommons.org/licenses/by-sa/4.0/
See Creative Commons License and MIT License here: https://creativecommons.org/licenses/by/4.0/ and https://opensource.org/licenses/MIT
*/
let num = 5; //changes the amount of circles in the main circle
let counter = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
noStroke();
fill(255);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
background(0);
}
function draw() {
background(0,20); //the second number changes the opacity of the background
//effects how much of the other circles that we see on the screen
translate(width / 2, height / 2); //moves the origin point to the center of the screen
let angle = (720 / num) * (counter % num * 0.5); //a variable to divide the circle into the number of circles you want to rotate around the origin point
rotate(angle); //rotates the circle around the angle which is calculated above
circle(35, 0, 52);
if (frameCount % num == 0) counter++; //the counter increases by 1 after each frame
}