{
const ctx = DOM.context2d(500,500)
const n_arcs = 30
const thickness = 10
const padding = 2
const pallete = ["#a8dadc","#457b9d","#1d3557"]
function genArc(){
return {
speed: randRange(-5, 5),
segs: Math.floor(randRange(1, 5)),
fill: randRange(.1,1.1),
color: randPick(pallete),
radius: randInt(0, 15) * (thickness + padding),
}
}
ctx.lineWidth = thickness
const arcs = new Array(n_arcs).fill(0).map(genArc)
let offset = Math.PI
while (true){
offset += .001
ctx.clearRect(0,0, 500, 500)
for (let i = 0; i < n_arcs; i++){
let arc = arcs[i]
let fill = arc.fill * mapRange(Math.cos(offset * 5), -1, 1, .01, 1)
segmentedArc(ctx, 250,250, arc.radius, arc.segs, fill , offset * arc.speed)
ctx.strokeStyle = arc.color
ctx.stroke()
}
yield ctx.canvas
}
}