Skip to content

Instantly share code, notes, and snippets.

@CharStiles
Last active September 5, 2021 18:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CharStiles/e2c31bf39f441cea7fe277aaa109d2e5 to your computer and use it in GitHub Desktop.
Save CharStiles/e2c31bf39f441cea7fe277aaa109d2e5 to your computer and use it in GitHub Desktop.
void main() {
vec2 pos = uv(); // origin is in center
float r = sin(time + pos.x);
// x is left to right, why we see red moving from right to left think about us as a camera moving around
// sin returns a number from -1 to 1, and colors are from 0 to 1, so it clips to no red half the time
float g = sin(-time + pos.y * 20.); // higher frequency green stripes
float b = mod(pos.x / pos.y,1.0);
// when x is eual to y the colors will be brighter, mod repeats the space
// mod is like a sawtooth function
vec4 color = vec4(r,g,b,1);
gl_FragColor = color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment