Back to shaders
Shader test bench
Polar Function
runnable transition
GLSL transition function. Stronghold supplies two demo textures and progress/time uniforms.
Code
// Author: Fernando Kuteken
// License: MIT
#define PI 3.14159265359
uniform int segments; // = 5
vec4 transition (vec2 uv) {
float angle = atan(uv.y - 0.5, uv.x - 0.5) - 0.5 * PI;
float normalized = (angle + 1.5 * PI) * (2.0 * PI);
float radius = (cos(float(segments) * angle) + 4.0) / 4.0;
float difference = length(uv - vec2(0.5, 0.5));
if (difference > radius * progress)
return getFromColor(uv);
else
return getToColor(uv);
}