xxxxxxxxxx
let size = 600;
const sketch = {
fps: 30, // frames per second
fpp: () => sketch.fps * sketch.duration, // frames per period
duration: 12 // seconds
};
let clk;
function setup() {
createCanvas(size, size);
frameRate(sketch.fps);
clk = new PeriodicFrameClock(sketch.fpp());
colorMode(HSB, 360, 100, 100, 1);
}
function draw() {
const inc = size/2;
const r = clk.continuousTime(2);
const s = size*0.9;
const s2 = s/1.618;
const m = clk.cos(clk.time());
const m2 = clk.cos(clk.time(2));
background(280, 80, 15);
stroke(50, map(m,-1,1,5,85), map(m,-1,1,85,5), 1);
strokeWeight(2);
translate(width / 2, height / 2);
fill(50,0,m2*50 + 50);
push();
const sw = 4;
strokeWeight(sw);
ellipse(0,0,s+sw,s2+sw);
pop();
for (let i = 0; i < inc; i++) {
const a = i * (TAU / inc);
fill(sin(a)*20 + 50, 95, 85, 0.2);
arc(0, 0, s, s2, a + r, a + (TAU/inc) + r, PIE);
}
}