Skip to content

Instantly share code, notes, and snippets.

@lalaroann
Last active February 19, 2022 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalaroann/4861335b346a804a3932e448985302db to your computer and use it in GitHub Desktop.
Save lalaroann/4861335b346a804a3932e448985302db to your computer and use it in GitHub Desktop.
// Author: Roann Cordova
// Course: ShaderArt (DIGF-3011, Winter 2022)
// Title: Week 2 Homework
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy; //this line normalize the value of the canvas
vec2 u_mouse = gl_FragCoord.xy/u_mouse.xy;
float pct = 0.0;
pct = distance(st,vec2(sin(u_time),u_mouse.y));
vec3 color3 = vec3(pct);
//RGB Channels of color3
// color3.r = fract(u_time-pct * (1.656/2.144) * 13.384 * st.x) - 0.076 *-st.x;
// color3.g = fract(u_time*0.848+pct * (6.776/1.312) * 25. *u_mouse.y) - 0.964 *-0.004;
// color3.b = sin(u_time*2.352 + pct *6.008*-st.y);
color3.r = fract(u_time*2.432-pct * (6.776/1.312) * 0.3 *u_mouse.y) - 0.964 *-0.004;
color3.g = fract(u_time*1.104-pct * (6.776/1.312) * 0.1 *u_mouse.y) - 0.964 *-0.004;
color3.b = fract(u_time*2.960+pct * (6.776/1.312) * 0.2 *u_mouse.y) - 2.692 *-0.004;
gl_FragColor = vec4(color3 ,1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment