shader({
width: 400,
height: 400,
iTime: true,
visibility,
inputs:{s:viewof h}
})`
#define PI 3.14159265359
#define TWO_PI 6.28318530718
void mainImage(out vec4 fragColor,in vec2 fragCoord) {
vec2 st = fragCoord.xy/iResolution.xy;
st.x *= iResolution.x/iResolution.y;
vec3 color = vec3(0.0);
float d = 0.0;
// Remap the space to -1. to 1.
st = st *2.-1.;
// Number of sides of your shape
int N = 3;
// Angle and radius from the current pixel
float a = atan(st.x,st.y)+PI;
float r = TWO_PI/float(N);
// Shaping function that modulate the distance
d = cos(floor(.5+a/r)*r-a)*length(st);
color = vec3(1.0-smoothstep(s,.41,d));
// color = vec3(d);
fragColor = vec4(color,1.0);
}
`