<pre>precision mediump float;
varying vec2 vTexCoord;
uniform vec2 resolution;
uniform float time;
vec3 rgb(float r, float g, float b){
return
vec3(r / 255.0, g / 255.0, b / 255.0);
}
vec3 rect (float x, float y, float w, float h, vec3 color){
vec2 coord = gl_FragCoord.xy;
coord.y = resolution.y - coord.y;
float width = 1.0 -mix(0.0, 1.0, step(x + w, coord.x));
float xPos = 1.0 -mix(0.0, 1.0, step(x, coord.x));
float height = 1.0 - mix(0.0, 1.0, step(y + h, coord.y));
float yPos = 1.0 - mix(0.0, 1.0, step(y, coord.y));
vec3 col = rgb(color.r, color.g, color.b);
return
col * ((height - yPos) * (width - xPos));
}
void main() {
float width = 200.0;
float height = 200.0;
vec2 center = resolution * 0.1;
float x = center.x - width*0.6;
float y = center.y - height*0.6;
vec3 pink = vec3(255.0,99.0, 71.0);
vec3 blue = rgb(0.0, 0.0, 255.0);
x += sin(time) *100.0;
vec3 r = rect(x, y, width, height, pink);
vec3 scene = mix(blue, r, r);
gl_FragColor = vec4( scene ,4.0);
}