xxxxxxxxxx
49
/*
Adapted from 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 totalPositions = 12;
let positionIndex = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
fill(0);
noStroke();
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
background(0);
}
function draw() {
background(220,250,10, 16);
fill(240,120,250,16);
translate(width / 2, height / 2);
positionIndex = round(frameCount / totalPositions);
let angle = (360 / totalPositions) * (positionIndex % totalPositions);
rotate(angle);
let minDimension = min(width, height);
let diam = minDimension;
circle(minDimension/2, 0, diam);
}