xxxxxxxxxx
let opShader
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
opShader = baseMaterialShader().modify({
'vec4 getFinalColor': `(vec4 c) {
return c.x > 0.75 ? vec4(1.) : vec4(0., 0., 0., 1.);
}`
})
}
function draw() {
background(255)
const t = millis()
const period = 3000
noStroke()
lights()
for (let i = 0; i < 20; i++) {
const off = i * 190
push()
const z = map((t+off)%period, 0, period, -8000, 800)
const x = sin(((t+off)%(4*period)) * 0.001) * min(width, height) * 0.15
const y = sin(((t+off)%(4*period)) * 0.0009) * min(width, height) * 0.15
translate(x, y, z)
ambientLight(map(z, -8000, -6000, 255, 0, true))
shader(opShader)
torus(min(width, height)/2, min(width, height)*0.1, 60)
pop()
}
}