basic: added a color spinner; utilities: added translations of inigo quilez' functions; weird: added psychedelic stars
This commit is contained in:
31
basic/spinner.glsl
Normal file
31
basic/spinner.glsl
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#define TWO_PI 6.28318530718
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform float u_time;
|
||||
|
||||
vec3 hsb2rgb( in vec3 c ){
|
||||
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
|
||||
6.0)-3.0)-1.0,
|
||||
0.0,
|
||||
1.0 );
|
||||
rgb = rgb*rgb*(3.0-2.0*rgb);
|
||||
return c.z * mix( vec3(1.0), rgb, c.y);
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
|
||||
vec2 toCenter = vec2(0.5)-st;
|
||||
float angle = atan(toCenter.y,toCenter.x);
|
||||
float radius = length(toCenter)*2.0;
|
||||
|
||||
color = hsb2rgb(vec3((angle/TWO_PI)+0.5*u_time*0.35,radius,1.0/radius));
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
}
|
Reference in New Issue
Block a user