aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Star.frag.glsl
blob: f61f43c94ab142b6a472aa6fcecf06a3a8aef0a4 (plain)
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
#ifdef GL_ES
precision highp float;
#endif

uniform float u_time;
uniform float u_speed;
uniform vec2 u_resolution;
uniform sampler2D u_tex0;

void main(void)
{
    vec2 uv;

	float time = u_time * u_speed;

    vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
    float a = atan(p.y,p.x);
    float r = sqrt(dot(p,p));
    float s = r * (1.0+0.8*cos(time*1.0));

    uv.x =          .02*p.y+.03*cos(-time+a*3.0)/s;
    uv.y = .1*time +.02*p.x+.03*sin(-time+a*3.0)/s;

    float w = .9 + pow(max(1.5-r,0.0),4.0);

    w*=0.6+0.4*cos(time+3.0*a);

    vec3 col =  texture2D(u_tex0,uv).xyz;

    gl_FragColor = vec4(col*w,1.0);
}