xxxxxxxxxx
let h = 800;
let orbs = [];
let radio_ring = []
let d = (x1,y1,x2,y2) => (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)
let max_d_s = (h/2.3)**2
let p = 0.6
function setup() {
createCanvas(h, h);
background(234,230,202);
frameRate(60)
radio_ring = polygonArr(h/2.4, 40, 0)
radio_ring = radio_ring.map( (it) => [it, 0.15])
}
function draw() {
strokeWeight(2)
background(234,230,202);
translate(h/2, h/2)
for(let i = 0; i<radio_ring.length; i++){radio_ring[i][2] =0.15}
orbs = polygonArr(h/4, 3, TWO_PI*frameCount/700)
for(let i = 0; i<radio_ring.length; i++){
for(let j = 0; j<orbs.length; j++){
let dist_s = d(orbs[j], radio_ring[i][0], radio_ring[i][1]) + 50
if (dist_s < max_d_s){
let prop = dist_s/(max_d_s)
if (prop > p){
let new_x = radio_ring[i][0] + (orbs[j][0] - radio_ring[i][0])*(1- (1-prop)/(1-p))
let new_y = radio_ring[i][1] + (orbs[j][1] - radio_ring[i][1])*(1- (1-prop)/(1-p))
draw_fancy_line(orbs[j], new_x, new_y)
}else{
line(orbs[j], radio_ring[i][0], radio_ring[i][1])
}
let cor = easeInCirc(1-prop)*2
cor = cor > 1?1:cor
if (prop <1 && radio_ring[i][2] < cor) radio_ring[i][2] = cor
}
}
}
orbs.map((it) => draw_orb(it))
radio_ring.map((it) => draw_radio(it))
}
function draw_orb(x,y) {
strokeWeight(0)
fill(0,)
circle(x,y, 60)
}
function draw_radio(x,y, str) {
let tr = 45;
noFill()
strokeWeight(2)
circle(x,y, tr)
strokeWeight(0)
fill(0,)
circle(x,y, (tr-4)*str)
}
function draw_fancy_line(x1,y1,x2,y2) {
strokeWeight(7)
point(x1,y1)
point(x2,y2)
strokeWeight(2)
line(x1,y1,x2,y2)
}
function easeInCirc(x) {
return 1 - sqrt(1 - pow(x, 2));
}