Published
Edited
Oct 9, 2019
Importers
11 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// access to u_resolution, u_mouse and u_time uniforms
pixelSpiritify(`vec4 render(vec2 st) {
return vec4(vec2(gl_FragCoord.x, u_mouse.x) / u_resolution, sin(u_time) / 2.0 + 0.5, 1.0);
}`)
Insert cell
// access to PixelSpirit functions
pixelSpiritify(`vec4 render(vec2 st) {
float color = 0.0;
color += smoothfill(circleSDF(st), 0.85, 0.01);
vec2 offset = vec2(mod(u_time/10., 2.) - 1.0, 0.0);
color -= smoothfill(circleSDF(st-offset), 0.84, 0.01);
color = clamp(color, 0.0, 1.0);
return vec4(vec3(color), 1.);
}`)
Insert cell
// specify canvas dimensions in options
pixelSpiritify(`
#define TAU (2.0*3.1415926)

vec4 render(vec2 st) {
float color = 0.0;
const float n = 12.0;
float a = TAU / n;
for (float i = 0.0; i < n; i++) {
vec2 xy = rotate(st, a * i);
xy.y -= 0.189;
float vsc = vesicaSDF(xy, 0.3);
color *= 1.0 - smoothstroke(vsc, 0.45, 0.1, 0.005) * step(0.5, xy.y);
color += smoothstroke(vsc, 0.45, 0.05, 0.005);
}
return vec4(vec3(color), 1.0);
}
`, { w: 300, h: 300 })
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more