Public
Edited
Mar 17
1 fork
1 star
Insert cell
Insert cell
cm.rasterGL({
width: 800,
height: 800,
fill: `
void main() {
vec2 uv = -2.0 + (gl_FragCoord.xy / cm_resolution) * 4.0;
float x = 0.0, y = 0.0, count = cm_time;
const int max = 80;
int j = 0;

for (int i = 0; i < max; i++) {
j = i;
float r = length(vec2(x, y));
float theta = atan(y, x);
float rn = pow(r, count);
x = rn * cos(count * theta) + uv.x;
y = rn * sin(count * theta) + uv.y;
if (x * x + y * y > 4.0) break;
}

float b = 1.0 - float(j * 4) / float(max);
gl_FragColor = vec4(b, b, b, 1.0);
}`
})
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more