blob: 6a760f7f3308b9c83a949e9828b8677c24fc5a40 [file] [log] [blame]
uniform vec2 in_origin;uniform vec2 in_touch;uniform float in_progress;uniform float in_maxRadius;uniform vec2 in_resolutionScale;uniform vec2 in_noiseScale;uniform float in_hasMask;uniform float in_noisePhase;uniform float in_turbulencePhase;uniform vec2 in_tCircle1;uniform vec2 in_tCircle2;uniform vec2 in_tCircle3;uniform vec2 in_tRotation1;uniform vec2 in_tRotation2;uniform vec2 in_tRotation3;layout(color)uniform vec4 in_color;layout(color)uniform vec4 in_sparkleColor;uniform shader in_shader;float a(vec2 b){b=fract(b*vec2(5.3987,5.4421));b+=dot(b.yx,b+vec2(21.5351,14.3137));float c=b.x*b.y;return(fract(c*95.4307)+fract(c*75.04961))-1.;}float b(float c,float d,float e){return step(d,c)*(1.-step(e,c));}float c(vec2 d,float e){float f=a(d);float g=0.;for(float j=0.;j<4.;j+=1.){float k=j*.1;float m=k+.05;float p=sin(3.14159274*(e+.35*j));g+=b(f+p,k,m);}return saturate(g)*in_sparkleColor.w;}float d(vec2 e,vec2 f,float g,float h){float i=h*.5;float j=distance(e,f);return 1.-smoothstep(1.-i,1.+i,j/g);}float e(vec2 f,vec2 g,float h,float i,float j){float k=.05*h;float l=h*i;float m=d(f,g,l+k,j);float n=d(f,g,max(l-k,0.),j);return saturate(m-n);}float f(float g,float h,float i){float j=clamp(i,g,h);return(j-g)/(h-g);}mat2 g(vec2 h){return mat2(h.x,-h.y,h.y,h.x);}float h(vec2 i,vec2 j,float k,vec2 l,vec2 m,float n){j=g(m)*(l-j)+l;j=mod(j,n)/i;float o=(n/i.y)*.5;float p=.65*o;return d(j,vec2(o),p,p*50.);}float i(vec2 j,float k){const vec2 l=vec2(.8);j=j*l;float m=h(l,j,k,in_tCircle1,in_tRotation1,.17);float n=h(l,j,k,in_tCircle2,in_tRotation2,.2);float o=h(l,j,k,in_tCircle3,in_tRotation3,.275);float p=((m*m+n)-o)*.5;return saturate(.45+.8*p);}vec4 main(vec2 j){float k=f(0.,.13,in_progress);float l=f(0.,1.,in_progress);float m=f(.4,.5,in_progress);float n=f(.4,1.,in_progress);vec2 o=mix(in_touch,in_origin,saturate(in_progress*2.));float q=e(j,o,in_maxRadius,l,1.);float r=min(k,1.-m);vec2 s=j*in_resolutionScale;vec2 t=s-mod(s,in_noiseScale);float u=i(s,in_turbulencePhase);float v=((c(t,in_noisePhase)*q)*r)*u;float w=min(k,1.-n);float x=(d(j,o,in_maxRadius*l,1.)*w)*in_color.w;vec4 y=vec4(in_color.xyz*x,x);vec4 z=vec4(in_sparkleColor.xyz*in_sparkleColor.w,in_sparkleColor.w);float A=float(in_hasMask==1.?float(in_shader.eval(j).w>0.):1.);return mix(y,z,v)*A;}