pub const STATIC_FADE: &str = "// Port of gl-transitions/transitions/StaticFade.glsl\n// Author: Ben Lucas\n// License: MIT\n// alpha2: PCG hashes replace upstream\'s `fract(sin(...))`: which cells show static is fixed,\n// and their colors change with the progress. The static is opaque, as upstream.\n\nfn static_fade_intensity(t: f32) -> f32 {\n let transition_progress = abs(2.0 * (t - 0.5));\n let threshold = 1.2 * (1.0 - transition_progress) - 0.1;\n return min(1.0, threshold);\n}\n\nfn gl_transition(uv: vec2f) -> vec4f {\n let base = select(gl_from_color(uv), gl_to_color(uv), progress() >= 0.5);\n let cell = floor(uv * params.n_noise_pixels);\n let x = builtin_cell(cell.x);\n let y = builtin_cell(cell.y);\n let frame = builtin_hash(bitcast<u32>(progress()));\n let noise = vec3f(\n builtin_unit(builtin_hash3(x, y, frame + 1u)),\n builtin_unit(builtin_hash3(x, y, frame + 2u)),\n builtin_unit(builtin_hash3(x, y, frame + 3u)),\n );\n let static_color = vec4f(params.static_luminosity * noise, 1.0);\n let chosen = builtin_unit(builtin_hash3(x, y, 0u)) <= static_fade_intensity(progress());\n return select(base, static_color, chosen);\n}\n";Expand description
Cut through cells of static transition body.