| 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; |
| const float PI_0 = 3.14159274; |
| float sparkles_0(float2 uv, float t); |
| float softCircle_0(float2 uv, float2 xy, float radius, float blur); |
| float softRing_0(float2 uv, float2 xy, float radius, float progress, float blur); |
| float subProgress_0(float start, float end, float progress); |
| float circle_grid_0(float2 resolution, float2 coord, float time, float2 center, float2 rotation, float cell_diameter); |
| float turbulence_0(float2 uv, float t); |
| float sparkles_0(float2 uv, float t) |
| { |
| float2 _0_n = uv; |
| _0_n = fract(_0_n * float2(5.3987, 5.4421)); |
| _0_n += dot(_0_n.yx, _0_n + float2(21.5351, 14.3137)); |
| float _1_xy = _0_n.x * _0_n.y; |
| float n = (fract(_1_xy * 95.4307) + fract(_1_xy * 75.04961)) - 1.0; |
| float s = 0.0; |
| for (float i = 0.0;i < 4.0; i += 1.0) |
| { |
| float l = i * 0.1; |
| float h = l + 0.05; |
| float o = sin(PI_0 * (t + 0.35 * i)); |
| float _2_v = n + o; |
| s += step(l, _2_v) * (1.0 - step(h, _2_v)); |
| } |
| return saturate(s) * in_sparkleColor.w; |
| } |
| float softCircle_0(float2 uv, float2 xy, float radius, float blur) |
| { |
| float blurHalf = blur * 0.5; |
| float d = distance(uv, xy); |
| return 1.0 - smoothstep(1.0 - blurHalf, 1.0 + blurHalf, d / radius); |
| } |
| float softRing_0(float2 uv, float2 xy, float radius, float progress, float blur) |
| { |
| float thickness = 0.05 * radius; |
| float currentRadius = radius * progress; |
| float circle_outer = softCircle_0(uv, xy, currentRadius + thickness, blur); |
| float circle_inner = softCircle_0(uv, xy, max(currentRadius - thickness, 0.0), blur); |
| return saturate(circle_outer - circle_inner); |
| } |
| float subProgress_0(float start, float end, float progress) |
| { |
| float sub = clamp(progress, start, end); |
| return (sub - start) / (end - start); |
| } |
| float circle_grid_0(float2 resolution, float2 coord, float time, float2 center, float2 rotation, float cell_diameter) |
| { |
| coord = float2x2(rotation.x, -rotation.y, rotation.y, rotation.x) * (center - coord) + center; |
| coord = mod(coord, cell_diameter) / resolution; |
| float normal_radius = (cell_diameter / resolution.y) * 0.5; |
| float radius = 0.65 * normal_radius; |
| return softCircle_0(coord, float2(normal_radius), radius, radius * 50.0); |
| } |
| float turbulence_0(float2 uv, float t) |
| { |
| const float2 scale = float2(0.8); |
| uv = uv * scale; |
| float g1 = circle_grid_0(scale, uv, t, in_tCircle1, in_tRotation1, 0.17); |
| float g2 = circle_grid_0(scale, uv, t, in_tCircle2, in_tRotation2, 0.2); |
| float g3 = circle_grid_0(scale, uv, t, in_tCircle3, in_tRotation3, 0.275); |
| float v = ((g1 * g1 + g2) - g3) * 0.5; |
| return saturate(0.45 + 0.8 * v); |
| } |
| float4 main(float2 p) |
| { |
| float fadeIn = subProgress_0(0.0, 0.13, in_progress); |
| float scaleIn = subProgress_0(0.0, 1.0, in_progress); |
| float fadeOutNoise = subProgress_0(0.4, 0.5, in_progress); |
| float fadeOutRipple = subProgress_0(0.4, 1.0, in_progress); |
| float2 center = mix(in_touch, in_origin, saturate(in_progress * 2.0)); |
| float ring = softRing_0(_coords, center, in_maxRadius, scaleIn, 1.0); |
| float alpha = min(fadeIn, 1.0 - fadeOutNoise); |
| float2 uv = _coords * in_resolutionScale; |
| float2 densityUv = uv - mod(uv, in_noiseScale); |
| float turbulence = turbulence_0(uv, in_turbulencePhase); |
| float sparkleAlpha = ((sparkles_0(densityUv, in_noisePhase) * ring) * alpha) * turbulence; |
| float fade = min(fadeIn, 1.0 - fadeOutRipple); |
| float waveAlpha = (softCircle_0(_coords, center, in_maxRadius * scaleIn, 1.0) * fade) * in_color.w; |
| float4 waveColor = float4(in_color.xyz * waveAlpha, waveAlpha); |
| float4 sparkleColor = float4(in_sparkleColor.xyz * in_sparkleColor.w, in_sparkleColor.w); |
| float mask = float(in_hasMask == 1.0 ? float(child_0.eval(_coords).w > 0.0) : 1.0); |
| return half4(mix(waveColor, sparkleColor, sparkleAlpha) * mask); |
| } |