1 varying mediump vec2 vTexCoord;
2 uniform sampler2D sTexture;
3 uniform sampler2D sStyle;
4 uniform sampler2D sMask;
5 uniform lowp float uHasMultipleTextColors;
6 uniform lowp vec4 uTextColorAnimatable;
7 uniform lowp vec4 uColor;
8 uniform lowp vec3 mixColor;
12 mediump vec4 textTexture = texture2D( sTexture, vTexCoord );
13 mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );
14 mediump float maskTexture = texture2D( sMask, vTexCoord ).r;
16 // Set the color of non-transparent pixel in text to what it is animated to.
17 // Markup text with multiple text colors are not animated (but can be supported later on if required).
18 // Emoji color are not animated.
19 mediump float vstep = step( 0.0001, textTexture.a );
20 textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );
22 // Draw the text as overlay above the style
23 gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, 1.0 );