/*{ "CATEGORIES": [ "Distortion" ], "CREDIT": "Automatically converted from https://www.github.com/gl-transitions/gl-transitions/tree/master/Swirl.glsl", "DESCRIPTION": "", "INPUTS": [ { "NAME": "startImage", "TYPE": "image" }, { "NAME": "endImage", "TYPE": "image" }, { "DEFAULT": 0, "MAX": 1, "MIN": 0, "NAME": "progress", "TYPE": "float" } ], "ISFVSN": "2" } */ vec4 getFromColor(vec2 inUV) { return IMG_NORM_PIXEL(startImage, inUV); } vec4 getToColor(vec2 inUV) { return IMG_NORM_PIXEL(endImage, inUV); } // License: MIT // Author: Sergey Kosarevsky // ( http://www.linderdaum.com ) // ported by gre from https://gist.github.com/corporateshark/cacfedb8cca0f5ce3f7c vec4 transition(vec2 UV) { float Radius = 1.0; float T = progress; UV -= vec2( 0.5, 0.5 ); float Dist = length(UV); if ( Dist < Radius ) { float Percent = (Radius - Dist) / Radius; float A = ( T <= 0.5 ) ? mix( 0.0, 1.0, T/0.5 ) : mix( 1.0, 0.0, (T-0.5)/0.5 ); float Theta = Percent * Percent * A * 8.0 * 3.14159; float S = sin( Theta ); float C = cos( Theta ); UV = vec2( dot(UV, vec2(C, -S)), dot(UV, vec2(S, C)) ); } UV += vec2( 0.5, 0.5 ); vec4 C0 = getFromColor(UV); vec4 C1 = getToColor(UV); return mix( C0, C1, T ); } void main() { gl_FragColor = transition(isf_FragNormCoord.xy); }