pub const DIRECTIONAL_EASING: &str = "// Port of gl-transitions/transitions/directional-easing.glsl\n// Author: Max Plotnikov\n// License: MIT\n// alpha2: the wrap seam is integrated as in `directional`; a (0, 0) direction takes the\n// default one.\nfn gl_transition(uv: vec2f) -> vec4f {\n var heading = sign(params.direction);\n if all(heading == vec2f(0.0)) { heading = vec2f(0.0, 1.0); }\n let easing = sqrt((2.0 - progress()) * progress());\n let width = 1.0 / resolution();\n let p = uv + easing * heading;\n // Integrate subpixel samples on the wrap seam. Detect it by distance along the moving axis,\n // since coverage rounding flips at interior and edge pixels.\n let to_seam = min(abs(p), abs(p - 1.0));\n var side = 1.0;\n if any((to_seam < width * 0.5) & (heading != vec2f(0.0))) { 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 let q = uv + offset + easing * heading;\n let f = fract(q);\n let inside = step(0.0, q.y) * step(q.y, 1.0) * step(0.0, q.x) * step(q.x, 1.0);\n let flipped = vec2f(f.x, 1.0 - f.y);\n color += mix(to_color(flipped), from_color(flipped), inside);\n }\n }\n return color / (side * side);\n}\n";Expand description
Eased directional push transition body.