pub const DIRECTIONAL: &str = "// Port of gl-transitions/transitions/Directional.glsl\n// Author: Ga\u{eb}tan Renaudeau\n// License: MIT\n// The schema admits (0, 0), which moves neither clip: take the default direction instead.\nfn directional_step() -> vec2f {\n let step = sign(params.direction);\n if all(step == vec2f(0.0)) { return vec2f(0.0, 1.0); }\n return step;\n}\n\nfn directional_sample(uv: vec2f) -> vec4f {\n let p = uv + progress() * directional_step();\n let wrapped = fract(p);\n let inside = step(0.0, p.y) * step(p.y, 1.0) * step(0.0, p.x) * step(p.x, 1.0);\n return mix(gl_to_color(wrapped), gl_from_color(wrapped), inside);\n}\n\nfn gl_transition(uv: vec2f) -> vec4f {\n let p = uv + progress() * directional_step();\n let width = 1.0 / resolution();\n let coverage = builtin_interval_coverage(p.x, width.x) * builtin_interval_coverage(p.y, width.y);\n if coverage <= 0.0 || coverage >= 1.0 { return directional_sample(uv); }\n // The two images wrap at the seam: integrate subpixel samples there instead of\n // blending samples from the wrong side of the wrapped texture.\n let side = floor(sqrt(clamp(max_filter_samples(), 1.0, 16.0)));\n var color = vec4f(0.0);\n for (var y = 0u; y < u32(side); y++) {\n for (var x = 0u; x < u32(side); x++) {\n let offset = ((vec2f(f32(x), f32(y)) + 0.5) / side - 0.5) * width;\n color += directional_sample(uv + offset);\n }\n }\n return color / (side * side);\n}\n";Expand description
Directional slide transition body.