Skip to main content

POLAR_FUNCTION

Constant POLAR_FUNCTION 

Source
pub const POLAR_FUNCTION: &str = "// Port of gl-transitions/transitions/polar_function.glsl\n// Author: Fernando Kuteken\n// License: MIT\n// alpha2: segments is rounded to a whole number, as upstream\'s int keeps the curve seamless;\n// the edge is antialiased.\nfn gl_transition(uv: vec2f) -> vec4f {\n    let pi = 3.14159265359;\n    let angle = atan2(uv.y - 0.5, uv.x - 0.5) - 0.5 * pi;\n    let radius = (cos(round(params.segments) * angle) + 4.0) / 4.0;\n    let difference = length(uv - vec2f(0.5, 0.5));\n    let outside = builtin_aa_step(radius * progress(), difference);\n    return mix(gl_to_color(uv), gl_from_color(uv), outside);\n}\n";
Expand description

Flower-shaped iris transition body.