xxxxxxxxxx
function setup() {
createCanvas(600, 600);
colorMode(HSL, 1);
noStroke();
}
function cosn(v){
return cos(v*TWO_PI)* 0.5 + 0.5
}
function invCosn(v){
return 1 - cos(v);
}
var radius = Math.sqrt(0.05);
var PHI = (1 + Math.sqrt(5)) / 2;
var dotsize = 0.009;
let t;
var frames = 1000;
function draw() {
background(0);
fill(255);
translate(width/2,height/2);
push();
beginShape();
vertex(-250,0);
bezierVertex(-130,-220,130,-220,250,0);
bezierVertex(130,220,-130,220,-250,0)
endShape();
pop();
fill(255, 244, 0);
circle(0,0,280);
t = fract(frameCount / frames);
t = mouseX/width;
if(mouseX>width){
mouseX = 0;
} else {
mouseXY = 0;
}
scale(width, height);
fill(255);
var count=2000 * invCosn(t);
for (let i=0; i<count* t; i++){
for (let f = i / count; f<1; ++f){
var a = i * PHI;
var dist = f*radius/1.05;
var x = cos(a*TWO_PI) * dist;
var y = sin(a*TWO_PI) * dist;
var sig = pow(cosn(f - t *15), 0.1);
var r = sig * dotsize;
const hue = fract(t + f * 0.5);
const sat = 1;
const light = 0.6 * sig + 0.25;
const clr = color(hue, sat, light);
fill(clr);
circle(x,y,r);
}
}
}