{
await visibility();
return shader({
height: width / 2,
width,
invalidation,
iTime: true,
inputs: { nleaves: viewof nleaves },
sources: [
await resolveLygia(`
#include "lygia/math/const.glsl"
#include "lygia/space/ratio.glsl"
#include "lygia/space/rotate.glsl"
#include "lygia/draw/stroke.glsl"
#include "lygia/draw/fill.glsl"
#include "lygia/sdf/triSDF.glsl"
#include "lygia/sdf/rectSDF.glsl"`)
]
})`
uniform sampler2D u_buffer;
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 st = fragCoord.xy / iResolution.xy ;
st = ratio(st, iResolution.xy);
vec3 color = vec3(0.0);
vec2 pixel = 1.0 / iResolution.xy;
st -= .5;
float r = dot(st,st);
float a = (atan(st.y,st.x)/PI);
vec2 uv = vec2(a,r);
vec2 grid = vec2(5.,log(r)*nleaves);
vec2 uv_i = floor(uv*grid);
uv.x += .5*mod(uv_i.y,2.);
vec2 uv_f = fract(uv*grid);
float shape = max(triSDF(uv_f), triSDF(vec2(uv_f.x,1.-uv_f.y)));
color += fill(shape,.9) * step(.75,1.-r);
fragColor = vec4(color, 1.0);
}
`;
}