drawParticles = regl({
vert: `
precision mediump float;
attribute float theta, speed, currentR;
varying float cntR;
uniform float pointSize;
uniform float time;
void main() {
cntR = currentR;
float xPos = currentR * cos(-time * speed + theta);
float yPos = currentR * sin(-time * speed + theta);
gl_Position = vec4(xPos, yPos, 0, 1.0);
gl_PointSize = currentR < 0.5 ? 2.6 : pointSize;
}`,
frag: `
precision mediump float;
varying float cntR;
void main() {
gl_FragColor = cntR >= 0.5 ? vec4(1, 1, 1, 0.88) : vec4(0.682, 0.859, 0.278, 0.95);
}`,
attributes: {
theta: thetaBuffer,
speed: speedBuffer,
currentR: currentRBuffer
},
uniforms: {
pointSize: 1.3,
time: ({ tick }) => tick * 0.4
},
count: count,
primitive: "points",
blend: {
enable: true,
func: {
src: "src alpha",
dst: "one minus src alpha"
},
equation: "add",
color: [0, 0, 0, 0]
}
})