thebookofshaders/06/mix.frag

22 lines
398 B
GLSL
Raw Normal View History

2015-03-15 15:35:14 +00:00
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
vec3 colorA = vec3(0.149,0.141,0.912);
vec3 colorB = vec3(1.000,0.833,0.224);
void main() {
vec3 color = vec3(0.0);
float pct = abs(sin(u_time));
2017-08-19 10:11:58 +00:00
// Mix uses pct (a value from 0-1) to
2015-03-22 16:49:04 +00:00
// mix the two colors
2017-08-19 10:11:58 +00:00
color = mix(colorA, colorB, pct);
2015-03-15 15:35:14 +00:00
gl_FragColor = vec4(color,1.0);
2017-08-19 10:11:58 +00:00
}