#version 120

uniform sampler2D texture;


uniform float time = 1.0;



void main()
{
	vec2 coord = gl_TexCoord[0].st;

    vec2 position = ( coord.xy)-vec2(0.5,-.2);

        // 256 angle steps
        float angle = atan(position.y,position.x)/(1*3.14159265359);
        angle -= floor(angle);
        float rad = length(position);
        
        float color = 0.0;
        for (int i = 0; i < 2; i++) {
            float angleFract = fract(angle*36.);
            float angleRnd = floor(angle*360.)+1.;
            float angleRnd1 = fract(angleRnd*fract(angleRnd*.7235)*45.1);
            float angleRnd2 = fract(angleRnd*fract(angleRnd*.82657)*13.724);
            float t = time+angleRnd1*100.;
            float radDist = sqrt(angleRnd2+float(i));
            
            float adist = radDist/rad*1.5;
            float dist = (t*.2+adist);
            dist = abs(fract(dist)-.5);
            color += max(0.,.8-dist*100./adist)*(.5-abs(angleFract-.5))*1./adist/radDist;
            
            angle = fract(angle);
        }
    
    
    
    
    
    


	gl_FragColor = vec4(color,color,color,color);
}