xxxxxxxxxx
25
/*
* Creative Coding Workshop #2 Demo - Repeated Circles forming Animated Lissajous
*
* Jack B. Du (github@jackbdu.com)
*/
function setup() {
// create a 400px by 400px canvas
createCanvas(400, 400);
}
function draw() {
// specify a background for each frame
background(220);
// calculate offsets based on frameCount
let offsetX = 0.03*sin(frameCount/40);
let offsetY = 0.03*sin(frameCount/50);
// a for loop that repeats 400 times, i counts from 0 to 399
for (let i = 0; i < 400; i++) {
circle(200+100*sin(i*(0.06+offsetX)),
200+100*cos(i*
(0.02+offsetY)),
50);
}
}