-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscan.frag
More file actions
34 lines (27 loc) · 764 Bytes
/
scan.frag
File metadata and controls
34 lines (27 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform float u_ctime;
uniform float u_gtime;
uniform float u_radius;
/*
void main() {
vec2 unit = 1.0 / resolution.xy;
vec4 tex = texture2D(CC_Texture0, v_texCoord);
float progress = (u_ctime / u_gtime);
float diff = abs(v_texCoord.x - progress);
if (diff <= unit.x * 15.0) {
tex = tex + vec4((diff / (unit.x * 15.0)), 0.0, 0.0, 0.0) * tex.a;
}
gl_FragColor = tex * v_fragmentColor;
}
*/
// VERSION 2 (one line)
void main() {
vec4 tex = texture2D(CC_Texture0, v_texCoord);
float progress = (u_ctime / u_gtime);
float diff = v_texCoord.x - progress;
if (diff <= 0.15 && diff > 0.0) {
tex = tex + vec4((diff / 0.15), 0.0, 0.0, 0.0) * tex.a;
}
gl_FragColor = tex * v_fragmentColor;
}