Skip to content

Instantly share code, notes, and snippets.

@bonau
Created August 19, 2019 09:04
Show Gist options
  • Select an option

  • Save bonau/3593b148dc0fb7422ab8ce4e431ae0f9 to your computer and use it in GitHub Desktop.

Select an option

Save bonau/3593b148dc0fb7422ab8ce4e431ae0f9 to your computer and use it in GitHub Desktop.
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
float random (in vec2 st) {
return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);
}
float circle(in vec2 _st, in float _radius, in float _border){
vec2 dist = _st-vec2(0.5);
return 1.-smoothstep(_radius-(_radius*_border),
_radius+(_radius*_border),
dot(dist,dist)*4.0);
}
void main(){
float min_radius = 0.2;
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st*=16.;
vec2 ipos = floor(st);
vec2 fpos = fract(st);
float wave = abs(cos(u_time + floor(ipos.x) + floor(ipos.y)));
vec3 color = vec3(circle(fpos,0.9 * (random(ipos) * (1. - min_radius) + min_radius) * wave, 0.2));
//gl_FragColor = vec4( color, random(ipos) * abs(cos(u_time * (ipos.x) / 4.))* abs(-cos(.21 + u_time / 4. * (ipos.y))) );
gl_FragColor = vec4( color, 1.0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment