Skip to content

Instantly share code, notes, and snippets.

@ponnamkarthik
Created February 9, 2023 02:18
Show Gist options
  • Save ponnamkarthik/4ae3c099f93a7d88bbd540e4157a5070 to your computer and use it in GitHub Desktop.
Save ponnamkarthik/4ae3c099f93a7d88bbd540e4157a5070 to your computer and use it in GitHub Desktop.
#define PI 3.1415926535897932384626433832795
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 center = fragCoord/iResolution.xy - vec2(0.5, 0.5);
float dist = length(center);
float p = (atan(center.y,center.x)) / (2.0 * PI);
float numStripes = 12.0;
bool stripeA = mod(floor((p * numStripes) + (sin(dist * 10.0 + sin(iTime)))), 2.0) == 1.0;
bool stripeB = mod(floor((p * numStripes) - (sin(dist * 10.0 + cos(iTime)))), 2.0) == 1.0;
vec3 col;
if (stripeA && stripeB)
{
col = vec3(0.4);
}
else if (!stripeA && stripeB)
{
col = vec3(0.5, 0.2, 0.1);
}
else if (stripeA && !stripeB)
{
col = vec3(0.3, 0.2, 0.1);
}
else
{
col = vec3(0.7);
}
fragColor = vec4(col,1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment