xxxxxxxxxx
31
/*
* Creative Coding Workshop #1 Preview - Colorful Circles Moving in a Circle
*
* Jack B. Du (github@jackbdu.com)
*/
let minLoopFrames = 240;
function setup() {
createCanvas(512, 512);
frameRate(60);
background(0);
}
function draw() {
let x = width / 2;
let y = width / 2;
let d = width / 4;
let r = width / 4;
fill(
178 + 177 * sin((frameCount / minLoopFrames) * TWO_PI),
178 + 177 * sin((frameCount / minLoopFrames * 2) * TWO_PI),
178 + 177 * sin((frameCount / minLoopFrames * 4) * TWO_PI)
);
circle(
x + r * sin((TWO_PI * frameCount) / minLoopFrames * 4),
y + r * cos((TWO_PI * frameCount) / minLoopFrames * 4),
d
);
}