/*{ "CATEGORIES": [ "Wipe" ], "CREDIT": "Automatically converted from https://www.github.com/gl-transitions/gl-transitions/tree/master/squareswire.glsl", "DESCRIPTION": "", "INPUTS": [ { "NAME": "startImage", "TYPE": "image" }, { "NAME": "endImage", "TYPE": "image" }, { "DEFAULT": 0, "MAX": 1, "MIN": 0, "NAME": "progress", "TYPE": "float" }, { "DEFAULT": 1.6, "MAX": 10, "MIN": 0, "NAME": "smoothness", "TYPE": "float" }, { "DEFAULT": [ 1, -0.5 ], "MAX": [ 1, 1 ], "MIN": [ -1, -1 ], "NAME": "direction", "TYPE": "point2D" }, { "DEFAULT": [ 10, 10 ], "MAX": [ 100, 100 ], "MIN": [ 0, 0 ], "NAME": "squares", "TYPE": "point2D" } ], "ISFVSN": "2" } */ vec4 getFromColor(vec2 inUV) { return IMG_NORM_PIXEL(startImage, inUV); } vec4 getToColor(vec2 inUV) { return IMG_NORM_PIXEL(endImage, inUV); } // Author: gre // License: MIT const vec2 center = vec2(0.5, 0.5); vec4 transition (vec2 p) { vec2 v = normalize(direction); v /= abs(v.x)+abs(v.y); float d = v.x * center.x + v.y * center.y; float offset = smoothness; float pr = smoothstep(-offset, 0.0, v.x * p.x + v.y * p.y - (d-0.5+progress*(1.+offset))); vec2 squarep = fract(p*vec2(squares)); vec2 squaremin = vec2(pr/2.0); vec2 squaremax = vec2(1.0 - pr/2.0); float a = (1.0 - step(progress, 0.0)) * step(squaremin.x, squarep.x) * step(squaremin.y, squarep.y) * step(squarep.x, squaremax.x) * step(squarep.y, squaremax.y); return mix(getFromColor(p), getToColor(p), a); } void main() { gl_FragColor = transition(isf_FragNormCoord.xy); }