Example :
Shader Toy Source
/////////////////////////////////////////////////////
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = (2.0*fragCoord.xy – iResolution.xy) / iResolution.yy;
uv *= 1.1;
float w = 2.0*fwidth(uv.x);
float t = 0.02;
float r = 1.0;
float s;
if (mod(iTime, 2.0) < 1.0) {
s = smoothstep(-w/2.0, w/2.0, length(uv) – r);
} else {
s = smoothstep(-w/2.0, w/2.0, abs(length(uv) – r) – t/2.0);
}
fragColor = vec4(s, s, s, 1.0);
}
Bazik file
/////////////////////////////////////////////////////
void main( void )
{
vec2 uv = (2.0*gl_FragCoord.xy – resolution.xy) / resolution.yy;
uv *= 1.1;
float w = 2.0*fwidth(uv.x);
float t = 0.02;
float r = 1.0;
float s;
if (mod(time, 2.0) < 1.0) {
s = smoothstep(-w/2.0, w/2.0, length(uv) – r);
} else {
s = smoothstep(-w/2.0, w/2.0, abs(length(uv) – r) – t/2.0);
}
gl_FragColor = vec4(s, s, s, 1.0);
}