glsl sandbox (一个点沿着曲线移动)


转载自  http://glslsandbox.com/

另:因为浏览器不支持webgl,所以有些效果为看代码的猜测


#ifdef GL_ES
precision mediump float;
#endif


#extension GL_OES_standard_derivatives : enable


uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform sampler2D backbuffer;


void main( void ) {


vec2 uv = ( gl_FragCoord.xy / resolution.xy );
vec2 backuv = uv;
vec4 backcolor = texture2D(backbuffer, backuv);

uv = uv * 2.0 - 1.0;


float m = 0.3137;
float n = 0.5321;
float t = time * 300.;
float x = sin(m * t);
float y = cos(n * t);


float c = distance(vec2(x, y), uv);
c = smoothstep(0.98, 0.999, 1.0 - c);

gl_FragColor = vec4(c) + backcolor;


}

你可能感兴趣的:(glsl sandbox (一个点沿着曲线移动))