|
It does not appear your computer can support WebGL.
Click here for more information. |
// Author: Sol Sarratea @solquemal// Title: Fundamentales - Figura simpleprecision mediump float;uniform float u_time;uniform vec2 u_resolution;vec2 uv(){ /* Devuelve las posiciones del canvas en rango [-1.,1.]x[-1.,1.] */ vec2 pos = gl_FragCoord.xy/u_resolution; pos.x *= u_resolution.y/u_resolution.x; pos = pos *2.-1.; return pos;}vec2 uvN(){ /* Devuelve las posiciones del canvas en rango [0.,1.]x[0.,1.] */ vec2 pos = gl_FragCoord.xy/u_resolution; pos.x *= u_resolution.y/u_resolution.x; return pos;}float sdSegment( in vec2 p, in vec2 a, in vec2 b ){ vec2 pa = p-a, ba = b-a; float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 ); return length( pa - ba*h );}float verEjes(vec2 pos,float verX, float verY){ float ejes; ejes += (1.-step(0.009, distance(pos.x,0.)))*verY; ejes += (1.-step(0.009, distance(pos.y,0.)))*verX; return ejes;}float verDistAlOrigen(vec2 pos, float radio){ float d = sdSegment(pos, vec2(0.), radio*vec2(-cos(u_time), -sin(u_time))); d = smoothstep(0.01,0.009,d); return d;}float verDistAlEjeY(vec2 pos, float radio){ float d = sdSegment(pos, vec2(0.), radio*vec2(cos(u_time), 0.)); d = smoothstep(0.01,0.009,d); return d;}float verDistAlEjeX(vec2 pos, float radio){ float d = sdSegment(pos, vec2(0.), radio*vec2(0., sin(u_time))); d = smoothstep(0.01,0.009,d); return d;}float caminoCirculo(float radio){ float d = smoothstep(0.02,0.,length(uv())-radio); d -=smoothstep(0.,-0.02,length(uv())-radio); return d;}void main() { vec2 pos = uv(); vec3 color; float circulo; float punto = smoothstep(0.5,0.49, length(pos)); color += punto; gl_FragColor = vec4(color, 1.); }