原文地址The Book of Shaders: Shapeshttps://thebookofshaders.com/07/?lan=ch
乱做一个:应用造型函数和绘图形状
#ifdef GL_ES
precision mediump float;
#endif
#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;
vec3 color = vec3(0.716,0.885,0.649);
vec3 color2 = vec3(0.516,0.614,0.885);
float r = sin(u_time) * cos(u_time);
// bottom-left
vec2 bl = step(0.4+r,st);
float pct = bl.x;
vec2 b3 = step(0.4-r,1.0-st);
pct *= b3.x ;
vec2 b4 = step(0.4+r,st);
float pct2 = b4.y;
vec2 b5 = step(0.4-r,1.0-st);
pct2 *= b5.y;
// top-right
//vec2 tr = step(vec2(0.1),1.0-st);
//pct *= tr.x * tr.y;
color += vec3(pct+pct2);
gl_FragColor = vec4(color,1.0);
}