1 varying float vPercentage;
2 varying mediump vec2 vTexCoord;
4 uniform sampler2D sTexture;
5 uniform lowp vec4 uColor;
6 uniform vec4 uTextureRect;
10 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
15 //Calculate the randomness
16 float offsetS = rand(vTexCoord * vPercentage) - vTexCoord.s;
17 float offsetT = rand(vec2(vTexCoord.t * vPercentage, vTexCoord.s * vPercentage)) - vTexCoord.t;
18 vec2 lookupCoord = vTexCoord + vec2(offsetS, offsetT) * vPercentage;
19 gl_FragColor = texture2D(sTexture, lookupCoord) * uColor;
20 gl_FragColor.a *= 1.0 - vPercentage;