Skip to main content

DIRECTIONAL_WIPE

Constant DIRECTIONAL_WIPE 

Source
pub const DIRECTIONAL_WIPE: &str = "// Port of gl-transitions/transitions/directionalwipe.glsl\n// Author: gre\n// License: MIT\nfn gl_transition(uv: vec2f) -> vec4f {\n    var direction = params.direction;\n    if (length(direction) < 0.000001) {\n        direction = vec2f(1.0, -1.0);\n    }\n    var vector = normalize(direction);\n    vector /= abs(vector.x) + abs(vector.y);\n    let edge = dot(vector, vec2f(0.5));\n    let mask = (1.0 - step(progress(), 0.0)) * (1.0 - builtin_aa_smoothstep(\n        -params.smoothness,\n        0.0,\n        dot(vector, uv) - (edge - 0.5 + progress() * (1.0 + params.smoothness)),\n    ));\n    return mix(gl_from_color(uv), gl_to_color(uv), mask);\n}\n";
Expand description

Soft directional wipe transition body.