pub const FADE_GRAYSCALE: &str = "// Port of gl-transitions/transitions/fadegrayscale.glsl\n// Author: gre\n// License: MIT\nfn grayscale(color: vec3f) -> vec3f {\n return vec3f(dot(color, vec3f(0.2126, 0.7152, 0.0722)));\n}\n\nfn gl_transition(uv: vec2f) -> vec4f {\n let source_color = gl_from_color(uv);\n let target_color = gl_to_color(uv);\n let gray_from = vec4f(grayscale(source_color.rgb), source_color.a);\n let gray_to = vec4f(grayscale(target_color.rgb), target_color.a);\n let from_mix = mix(gray_from, source_color, 1.0 - builtin_smoothstep(0.0, 1.0 - params.intensity, progress()));\n let to_mix = mix(gray_to, target_color, builtin_smoothstep(params.intensity, 1.0, progress()));\n return mix(from_mix, to_mix, progress());\n}\n";Expand description
Fade-through-grayscale transition body.