// Linear blur crossfade, from gl-transitions.com // Author: gre (MIT) // Description: a crossfade that passes through a directional blur. // // Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag): the version // header is prepended by WallpaperService::shaderSource, the fullscreen // triangle comes from wallpaper.vert, and getFromColor/getToColor apply the // crop + flip convention. `uv` is bottom-left origin per gl-transitions. // // Optional gl-transitions params are fixed here: intensity = 0.1. uniform sampler2D from; uniform sampler2D to; uniform vec2 size; uniform vec4 fromCrop; uniform vec4 toCrop; uniform float progress; uniform float fromFlip; uniform float toFlip; out vec4 outColor; const float intensity = 0.1; const int passes = 6; vec4 getFromColor(vec2 uv) { vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y); return texture(from, fromCrop.xy + s * fromCrop.zw); } vec4 getToColor(vec2 uv) { vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y); return texture(to, toCrop.xy + s * toCrop.zw); } vec4 transition(vec2 uv) { vec4 c1 = vec4(0.0); vec4 c2 = vec4(0.0); float disp = intensity * (0.5 - distance(0.5, progress)); for (int xi = 0; xi < passes; xi++) { float x = float(xi) / float(passes) - 0.5; for (int yi = 0; yi < passes; yi++) { float y = float(yi) / float(passes) - 0.5; vec2 v = vec2(x, y); c1 += getFromColor(uv + disp * v); c2 += getToColor(uv + disp * v); } } c1 /= float(passes * passes); c2 /= float(passes * passes); return mix(c1, c2, progress); } void main() { vec2 uv = gl_FragCoord.xy / size; outColor = transition(uv); }