Skip to main content

SWIRL_EFFECT

Constant SWIRL_EFFECT 

Source
pub const SWIRL_EFFECT: &str = "// The picture turned about `center`, most at the center and not at all from `radius` out. The\n// turn goes with the square of the distance to the rim, so it and its slope end at zero there.\nfn effect(uv: vec2f, _src: vec4f) -> vec4f {\n    let aspect = builtin_aspect();\n    let p = (uv - params.center) * aspect;\n    let t = clamp(1.0 - length(p) / max(params.radius, 0.0001), 0.0, 1.0);\n    let q = builtin_rotate(p, radians(params.angle) * t * t);\n    let source = params.center + q / aspect;\n    return builtin_sample_edge(source, fwidthFine(source), params.edge);\n}\n";
Expand description

Built-in swirl body.