UNPKG

@omnimedia/omnitool

Version:

open source video processing tools

1,390 lines (1,192 loc) 757 kB
import"./chunk-KNFR52ZD.js";import{a as rl,d as Yr}from"./chunk-R5JR5S25.js";import"./chunk-7Z2UP4WF.js";import"./chunk-TGCBK6ZU.js";import"./chunk-Y2VKPF3Q.js";import{a as na}from"./chunk-VUKIR4XQ.js";import"./chunk-73DDAAII.js";import{c as Oo,e as nl,k as Jr,m as ra}from"./chunk-GT46VDWY.js";import{a as Ln,j as ue,o as $s,r as el,s as tl,t as ur,w as P}from"./chunk-TT2DOKKC.js";import{a as ht,b as oa,c as Jn,d as Wn}from"./chunk-RQIYA7WI.js";import"./chunk-R6QFK4E5.js";import{a as ta}from"./chunk-ASDTIIJ2.js";import"./chunk-HWI53FTI.js";import{a as ea}from"./chunk-UYPHPFEQ.js";import"./chunk-2B6UHEI4.js";import{o as ol}from"./chunk-LFJVYUTB.js";import{D as we,E as lr,H as F,J as _,L as Yn,M as Vr,a as Tp,b as $c,c as Pp,d as Je,e as qr,g as fe,i as Dt,j as Xs,k as js,m as qn,o as W,s as Kn,w as Zs,y as Kr,z as Vn}from"./chunk-ERLCDDYH.js";var fp=Tp((M_,up)=>{up.exports=[{name:"Bounce",paramsTypes:{shadow_colour:"vec4",shadow_height:"float",bounces:"float"},defaultParams:{shadow_colour:[0,0,0,.6],shadow_height:.075,bounces:3},glsl:`// Author: Adrian Purser // License: MIT uniform vec4 shadow_colour; // = vec4(0.,0.,0.,.6) uniform float shadow_height; // = 0.075 uniform float bounces; // = 3.0 const float PI = 3.14159265358; vec4 transition (vec2 uv) { float time = progress; float stime = sin(time * PI / 2.); float phase = time * PI * bounces; float y = (abs(cos(phase))) * (1.0 - stime); float d = uv.y - y; return mix( mix( getToColor(uv), shadow_colour, step(d, shadow_height) * (1. - mix( ((d / shadow_height) * shadow_colour.a) + (1.0 - shadow_colour.a), 1.0, smoothstep(0.95, 1., progress) // fade-out the shadow at the end )) ), getFromColor(vec2(uv.x, uv.y + (1.0 - y))), step(d, 0.0) ); } `,author:"Adrian Purser",license:"MIT",createdAt:"Fri, 10 Nov 2017 17:01:45 +0000",updatedAt:"Sat, 11 Nov 2017 08:50:40 +0100"},{name:"BowTieHorizontal",paramsTypes:{},defaultParams:{},glsl:`// Author: huynx // License: MIT vec2 bottom_left = vec2(0.0, 1.0); vec2 bottom_right = vec2(1.0, 1.0); vec2 top_left = vec2(0.0, 0.0); vec2 top_right = vec2(1.0, 0.0); vec2 center = vec2(0.5, 0.5); float check(vec2 p1, vec2 p2, vec2 p3) { return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y); } bool PointInTriangle (vec2 pt, vec2 p1, vec2 p2, vec2 p3) { bool b1, b2, b3; b1 = check(pt, p1, p2) < 0.0; b2 = check(pt, p2, p3) < 0.0; b3 = check(pt, p3, p1) < 0.0; return ((b1 == b2) && (b2 == b3)); } bool in_left_triangle(vec2 p){ vec2 vertex1, vertex2, vertex3; vertex1 = vec2(progress, 0.5); vertex2 = vec2(0.0, 0.5-progress); vertex3 = vec2(0.0, 0.5+progress); if (PointInTriangle(p, vertex1, vertex2, vertex3)) { return true; } return false; } bool in_right_triangle(vec2 p){ vec2 vertex1, vertex2, vertex3; vertex1 = vec2(1.0-progress, 0.5); vertex2 = vec2(1.0, 0.5-progress); vertex3 = vec2(1.0, 0.5+progress); if (PointInTriangle(p, vertex1, vertex2, vertex3)) { return true; } return false; } float blur_edge(vec2 bot1, vec2 bot2, vec2 top, vec2 testPt) { vec2 lineDir = bot1 - top; vec2 perpDir = vec2(lineDir.y, -lineDir.x); vec2 dirToPt1 = bot1 - testPt; float dist1 = abs(dot(normalize(perpDir), dirToPt1)); lineDir = bot2 - top; perpDir = vec2(lineDir.y, -lineDir.x); dirToPt1 = bot2 - testPt; float min_dist = min(abs(dot(normalize(perpDir), dirToPt1)), dist1); if (min_dist < 0.005) { return min_dist / 0.005; } else { return 1.0; }; } vec4 transition (vec2 uv) { if (in_left_triangle(uv)) { if (progress < 0.1) { return getFromColor(uv); } if (uv.x < 0.5) { vec2 vertex1 = vec2(progress, 0.5); vec2 vertex2 = vec2(0.0, 0.5-progress); vec2 vertex3 = vec2(0.0, 0.5+progress); return mix( getFromColor(uv), getToColor(uv), blur_edge(vertex2, vertex3, vertex1, uv) ); } else { if (progress > 0.0) { return getToColor(uv); } else { return getFromColor(uv); } } } else if (in_right_triangle(uv)) { if (uv.x >= 0.5) { vec2 vertex1 = vec2(1.0-progress, 0.5); vec2 vertex2 = vec2(1.0, 0.5-progress); vec2 vertex3 = vec2(1.0, 0.5+progress); return mix( getFromColor(uv), getToColor(uv), blur_edge(vertex2, vertex3, vertex1, uv) ); } else { return getFromColor(uv); } } else { return getFromColor(uv); } }`,author:"huynx",license:"MIT",createdAt:"Sat, 24 Mar 2018 12:54:26 +0100",updatedAt:"Sat, 24 Mar 2018 12:54:26 +0100"},{name:"BowTieVertical",paramsTypes:{},defaultParams:{},glsl:`// Author: huynx\r // License: MIT\r \r float check(vec2 p1, vec2 p2, vec2 p3)\r {\r return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);\r }\r \r bool PointInTriangle (vec2 pt, vec2 p1, vec2 p2, vec2 p3)\r {\r bool b1, b2, b3;\r b1 = check(pt, p1, p2) < 0.0;\r b2 = check(pt, p2, p3) < 0.0;\r b3 = check(pt, p3, p1) < 0.0;\r return ((b1 == b2) && (b2 == b3));\r }\r \r bool in_top_triangle(vec2 p){\r vec2 vertex1, vertex2, vertex3;\r vertex1 = vec2(0.5, progress);\r vertex2 = vec2(0.5-progress, 0.0);\r vertex3 = vec2(0.5+progress, 0.0);\r if (PointInTriangle(p, vertex1, vertex2, vertex3))\r {\r return true;\r }\r return false;\r }\r \r bool in_bottom_triangle(vec2 p){\r vec2 vertex1, vertex2, vertex3;\r vertex1 = vec2(0.5, 1.0 - progress);\r vertex2 = vec2(0.5-progress, 1.0);\r vertex3 = vec2(0.5+progress, 1.0);\r if (PointInTriangle(p, vertex1, vertex2, vertex3))\r {\r return true;\r }\r return false;\r }\r \r float blur_edge(vec2 bot1, vec2 bot2, vec2 top, vec2 testPt)\r {\r vec2 lineDir = bot1 - top;\r vec2 perpDir = vec2(lineDir.y, -lineDir.x);\r vec2 dirToPt1 = bot1 - testPt;\r float dist1 = abs(dot(normalize(perpDir), dirToPt1));\r \r lineDir = bot2 - top;\r perpDir = vec2(lineDir.y, -lineDir.x);\r dirToPt1 = bot2 - testPt;\r float min_dist = min(abs(dot(normalize(perpDir), dirToPt1)), dist1);\r \r if (min_dist < 0.005) {\r return min_dist / 0.005;\r }\r else {\r return 1.0;\r };\r }\r \r \r vec4 transition (vec2 uv) {\r if (in_top_triangle(uv))\r {\r if (progress < 0.1)\r {\r return getFromColor(uv);\r }\r if (uv.y < 0.5)\r {\r vec2 vertex1 = vec2(0.5, progress);\r vec2 vertex2 = vec2(0.5-progress, 0.0);\r vec2 vertex3 = vec2(0.5+progress, 0.0);\r return mix(\r getFromColor(uv),\r getToColor(uv),\r blur_edge(vertex2, vertex3, vertex1, uv)\r );\r }\r else\r {\r if (progress > 0.0)\r {\r return getToColor(uv);\r }\r else\r {\r return getFromColor(uv);\r }\r } \r }\r else if (in_bottom_triangle(uv))\r {\r if (uv.y >= 0.5)\r {\r vec2 vertex1 = vec2(0.5, 1.0-progress);\r vec2 vertex2 = vec2(0.5-progress, 1.0);\r vec2 vertex3 = vec2(0.5+progress, 1.0);\r return mix(\r getFromColor(uv),\r getToColor(uv),\r blur_edge(vertex2, vertex3, vertex1, uv)\r ); \r }\r else\r {\r return getFromColor(uv);\r }\r }\r else {\r return getFromColor(uv);\r }\r }`,author:"huynx",license:"MIT",createdAt:"Tue, 27 Mar 2018 10:07:54 +0700",updatedAt:"Tue, 27 Mar 2018 10:07:54 +0700"},{name:"ButterflyWaveScrawler",paramsTypes:{amplitude:"float",waves:"float",colorSeparation:"float"},defaultParams:{amplitude:1,waves:30,colorSeparation:.3},glsl:`// Author: mandubian // License: MIT uniform float amplitude; // = 1.0 uniform float waves; // = 30.0 uniform float colorSeparation; // = 0.3 float PI = 3.14159265358979323846264; float compute(vec2 p, float progress, vec2 center) { vec2 o = p*sin(progress * amplitude)-center; // horizontal vector vec2 h = vec2(1., 0.); // butterfly polar function (don't ask me why this one :)) float theta = acos(dot(o, h)) * waves; return (exp(cos(theta)) - 2.*cos(4.*theta) + pow(sin((2.*theta - PI) / 24.), 5.)) / 10.; } vec4 transition(vec2 uv) { vec2 p = uv.xy / vec2(1.0).xy; float inv = 1. - progress; vec2 dir = p - vec2(.5); float dist = length(dir); float disp = compute(p, progress, vec2(0.5, 0.5)) ; vec4 texTo = getToColor(p + inv*disp); vec4 texFrom = vec4( getFromColor(p + progress*disp*(1.0 - colorSeparation)).r, getFromColor(p + progress*disp).g, getFromColor(p + progress*disp*(1.0 + colorSeparation)).b, 1.0); return texTo*progress + texFrom*inv; } `,author:"mandubian",license:"MIT",createdAt:"Thu, 1 Jun 2017 11:47:17 +0200",updatedAt:"Thu, 1 Jun 2017 11:47:17 +0200"},{name:"CircleCrop",paramsTypes:{bgcolor:"vec4"},defaultParams:{bgcolor:[0,0,0,1]},glsl:`// License: MIT // Author: fkuteken // ported by gre from https://gist.github.com/fkuteken/f63e3009c1143950dee9063c3b83fb88 uniform vec4 bgcolor; // = vec4(0.0, 0.0, 0.0, 1.0) vec2 ratio2 = vec2(1.0, 1.0 / ratio); float s = pow(2.0 * abs(progress - 0.5), 3.0); vec4 transition(vec2 p) { float dist = length((vec2(p) - 0.5) * ratio2); return mix( progress < 0.5 ? getFromColor(p) : getToColor(p), // branching is ok here as we statically depend on progress uniform (branching won't change over pixels) bgcolor, step(s, dist) ); } `,license:"MIT",author:"fkuteken",createdAt:"Mon, 12 Jun 2017 12:52:34 +0800",updatedAt:"Mon, 12 Jun 2017 12:52:34 +0800"},{name:"ColourDistance",paramsTypes:{power:"float"},defaultParams:{power:5},glsl:`// License: MIT // Author: P-Seebauer // ported by gre from https://gist.github.com/P-Seebauer/2a5fa2f77c883dd661f9 uniform float power; // = 5.0 vec4 transition(vec2 p) { vec4 fTex = getFromColor(p); vec4 tTex = getToColor(p); float m = step(distance(fTex, tTex), progress); return mix( mix(fTex, tTex, m), tTex, pow(progress, power) ); } `,license:"MIT",author:"P-Seebauer",createdAt:"Mon, 12 Jun 2017 12:57:42 +0800",updatedAt:"Mon, 12 Jun 2017 12:57:42 +0800"},{name:"CrazyParametricFun",paramsTypes:{a:"float",b:"float",amplitude:"float",smoothness:"float"},defaultParams:{a:4,b:1,amplitude:120,smoothness:.1},glsl:`// Author: mandubian // License: MIT uniform float a; // = 4 uniform float b; // = 1 uniform float amplitude; // = 120 uniform float smoothness; // = 0.1 vec4 transition(vec2 uv) { vec2 p = uv.xy / vec2(1.0).xy; vec2 dir = p - vec2(.5); float dist = length(dir); float x = (a - b) * cos(progress) + b * cos(progress * ((a / b) - 1.) ); float y = (a - b) * sin(progress) - b * sin(progress * ((a / b) - 1.)); vec2 offset = dir * vec2(sin(progress * dist * amplitude * x), sin(progress * dist * amplitude * y)) / smoothness; return mix(getFromColor(p + offset), getToColor(p), smoothstep(0.2, 1.0, progress)); } `,author:"mandubian",license:"MIT",createdAt:"Thu, 1 Jun 2017 13:03:12 +0200",updatedAt:"Thu, 1 Jun 2017 13:03:12 +0200"},{name:"CrossZoom",paramsTypes:{strength:"float"},defaultParams:{strength:.4},glsl:`// License: MIT // Author: rectalogic // ported by gre from https://gist.github.com/rectalogic/b86b90161503a0023231 // Converted from https://github.com/rectalogic/rendermix-basic-effects/blob/master/assets/com/rendermix/CrossZoom/CrossZoom.frag // Which is based on https://github.com/evanw/glfx.js/blob/master/src/filters/blur/zoomblur.js // With additional easing functions from https://github.com/rectalogic/rendermix-basic-effects/blob/master/assets/com/rendermix/Easing/Easing.glsllib uniform float strength; // = 0.4 const float PI = 3.141592653589793; float Linear_ease(in float begin, in float change, in float duration, in float time) { return change * time / duration + begin; } float Exponential_easeInOut(in float begin, in float change, in float duration, in float time) { if (time == 0.0) return begin; else if (time == duration) return begin + change; time = time / (duration / 2.0); if (time < 1.0) return change / 2.0 * pow(2.0, 10.0 * (time - 1.0)) + begin; return change / 2.0 * (-pow(2.0, -10.0 * (time - 1.0)) + 2.0) + begin; } float Sinusoidal_easeInOut(in float begin, in float change, in float duration, in float time) { return -change / 2.0 * (cos(PI * time / duration) - 1.0) + begin; } float rand (vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } vec3 crossFade(in vec2 uv, in float dissolve) { return mix(getFromColor(uv).rgb, getToColor(uv).rgb, dissolve); } vec4 transition(vec2 uv) { vec2 texCoord = uv.xy / vec2(1.0).xy; // Linear interpolate center across center half of the image vec2 center = vec2(Linear_ease(0.25, 0.5, 1.0, progress), 0.5); float dissolve = Exponential_easeInOut(0.0, 1.0, 1.0, progress); // Mirrored sinusoidal loop. 0->strength then strength->0 float strength = Sinusoidal_easeInOut(0.0, strength, 0.5, progress); vec3 color = vec3(0.0); float total = 0.0; vec2 toCenter = center - texCoord; /* randomize the lookup values to hide the fixed number of samples */ float offset = rand(uv); for (float t = 0.0; t <= 40.0; t++) { float percent = (t + offset) / 40.0; float weight = 4.0 * (percent - percent * percent); color += crossFade(texCoord + toCenter * percent * strength, dissolve) * weight; total += weight; } return vec4(color / total, 1.0); } `,license:"MIT",author:"rectalogic",createdAt:"Mon, 12 Jun 2017 12:33:07 +0800",updatedAt:"Mon, 12 Jun 2017 12:33:07 +0800"},{name:"Directional",paramsTypes:{direction:"vec2"},defaultParams:{direction:[0,1]},glsl:`// Author: Ga\xEBtan Renaudeau // License: MIT uniform vec2 direction; // = vec2(0.0, 1.0) vec4 transition (vec2 uv) { vec2 p = uv + progress * sign(direction); vec2 f = fract(p); return mix( getToColor(f), getFromColor(f), step(0.0, p.y) * step(p.y, 1.0) * step(0.0, p.x) * step(p.x, 1.0) ); } `,author:"Ga\xEBtan Renaudeau",license:"MIT",createdAt:"Thu, 19 Apr 2018 12:20:29 +0200",updatedAt:"Thu, 19 Apr 2018 12:20:29 +0200"},{name:"DoomScreenTransition",paramsTypes:{bars:"int",amplitude:"float",noise:"float",frequency:"float",dripScale:"float"},defaultParams:{bars:30,amplitude:2,noise:.1,frequency:.5,dripScale:.5},glsl:`// Author: Zeh Fernando // License: MIT // Transition parameters -------- // Number of total bars/columns uniform int bars; // = 30 // Multiplier for speed ratio. 0 = no variation when going down, higher = some elements go much faster uniform float amplitude; // = 2 // Further variations in speed. 0 = no noise, 1 = super noisy (ignore frequency) uniform float noise; // = 0.1 // Speed variation horizontally. the bigger the value, the shorter the waves uniform float frequency; // = 0.5 // How much the bars seem to "run" from the middle of the screen first (sticking to the sides). 0 = no drip, 1 = curved drip uniform float dripScale; // = 0.5 // The code proper -------- float rand(int num) { return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num))); } float wave(int num) { float fn = float(num) * frequency * 0.1 * float(bars); return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn+10.0) * 0.3) / 2.0 + 0.5; } float drip(int num) { return sin(float(num) / float(bars - 1) * 3.141592) * dripScale; } float pos(int num) { return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num)); } vec4 transition(vec2 uv) { int bar = int(uv.x * (float(bars))); float scale = 1.0 + pos(bar) * amplitude; float phase = progress * scale; float posY = uv.y / vec2(1.0).y; vec2 p; vec4 c; if (phase + posY < 1.0) { p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy; c = getFromColor(p); } else { p = uv.xy / vec2(1.0).xy; c = getToColor(p); } // Finally, apply the color return c; } `,author:"Zeh Fernando",license:"MIT",createdAt:"Tue, 30 May 2017 09:39:09 -0700",updatedAt:"Tue, 30 May 2017 09:39:09 -0700"},{name:"Dreamy",paramsTypes:{},defaultParams:{},glsl:`// Author: mikolalysenko // License: MIT vec2 offset(float progress, float x, float theta) { float phase = progress*progress + progress + theta; float shifty = 0.03*progress*cos(10.0*(progress+x)); return vec2(0, shifty); } vec4 transition(vec2 p) { return mix(getFromColor(p + offset(progress, p.x, 0.0)), getToColor(p + offset(1.0-progress, p.x, 3.14)), progress); } `,author:"mikolalysenko",license:"MIT",createdAt:"Mon, 12 Jun 2017 12:27:38 +0800",updatedAt:"Mon, 12 Jun 2017 12:27:38 +0800"},{name:"DreamyZoom",paramsTypes:{rotation:"float",scale:"float"},defaultParams:{rotation:6,scale:1.2},glsl:`// Author: Zeh Fernando // License: MIT // Definitions -------- #define DEG2RAD 0.03926990816987241548078304229099 // 1/180*PI // Transition parameters -------- // In degrees uniform float rotation; // = 6 // Multiplier uniform float scale; // = 1.2 // The code proper -------- vec4 transition(vec2 uv) { // Massage parameters float phase = progress < 0.5 ? progress * 2.0 : (progress - 0.5) * 2.0; float angleOffset = progress < 0.5 ? mix(0.0, rotation * DEG2RAD, phase) : mix(-rotation * DEG2RAD, 0.0, phase); float newScale = progress < 0.5 ? mix(1.0, scale, phase) : mix(scale, 1.0, phase); vec2 center = vec2(0, 0); // Calculate the source point vec2 assumedCenter = vec2(0.5, 0.5); vec2 p = (uv.xy - vec2(0.5, 0.5)) / newScale * vec2(ratio, 1.0); // This can probably be optimized (with distance()) float angle = atan(p.y, p.x) + angleOffset; float dist = distance(center, p); p.x = cos(angle) * dist / ratio + 0.5; p.y = sin(angle) * dist + 0.5; vec4 c = progress < 0.5 ? getFromColor(p) : getToColor(p); // Finally, apply the color return c + (progress < 0.5 ? mix(0.0, 1.0, phase) : mix(1.0, 0.0, phase)); } `,author:"Zeh Fernando",license:"MIT",createdAt:"Tue, 30 May 2017 10:44:06 -0700",updatedAt:"Tue, 30 May 2017 10:44:06 -0700"},{name:"GlitchDisplace",paramsTypes:{},defaultParams:{},glsl:`// Author: Matt DesLauriers // License: MIT highp float random(vec2 co) { highp float a = 12.9898; highp float b = 78.233; highp float c = 43758.5453; highp float dt= dot(co.xy ,vec2(a,b)); highp float sn= mod(dt,3.14); return fract(sin(sn) * c); } float voronoi( in vec2 x ) { vec2 p = floor( x ); vec2 f = fract( x ); float res = 8.0; for( float j=-1.; j<=1.; j++ ) for( float i=-1.; i<=1.; i++ ) { vec2 b = vec2( i, j ); vec2 r = b - f + random( p + b ); float d = dot( r, r ); res = min( res, d ); } return sqrt( res ); } vec2 displace(vec4 tex, vec2 texCoord, float dotDepth, float textureDepth, float strength) { float b = voronoi(.003 * texCoord + 2.0); float g = voronoi(0.2 * texCoord); float r = voronoi(texCoord - 1.0); vec4 dt = tex * 1.0; vec4 dis = dt * dotDepth + 1.0 - tex * textureDepth; dis.x = dis.x - 1.0 + textureDepth*dotDepth; dis.y = dis.y - 1.0 + textureDepth*dotDepth; dis.x *= strength; dis.y *= strength; vec2 res_uv = texCoord ; res_uv.x = res_uv.x + dis.x - 0.0; res_uv.y = res_uv.y + dis.y; return res_uv; } float ease1(float t) { return t == 0.0 || t == 1.0 ? t : t < 0.5 ? +0.5 * pow(2.0, (20.0 * t) - 10.0) : -0.5 * pow(2.0, 10.0 - (t * 20.0)) + 1.0; } float ease2(float t) { return t == 1.0 ? t : 1.0 - pow(2.0, -10.0 * t); } vec4 transition(vec2 uv) { vec2 p = uv.xy / vec2(1.0).xy; vec4 color1 = getFromColor(p); vec4 color2 = getToColor(p); vec2 disp = displace(color1, p, 0.33, 0.7, 1.0-ease1(progress)); vec2 disp2 = displace(color2, p, 0.33, 0.5, ease2(progress)); vec4 dColor1 = getToColor(disp); vec4 dColor2 = getFromColor(disp2); float val = ease1(progress); vec3 gray = vec3(dot(min(dColor2, dColor1).rgb, vec3(0.299, 0.587, 0.114))); dColor2 = vec4(gray, 1.0); dColor2 *= 2.0; color1 = mix(color1, dColor2, smoothstep(0.0, 0.5, progress)); color2 = mix(color2, dColor1, smoothstep(1.0, 0.5, progress)); return mix(color1, color2, val); //gl_FragColor = mix(gl_FragColor, dColor, smoothstep(0.0, 0.5, progress)); //gl_FragColor = mix(texture2D(from, p), texture2D(to, p), progress); } `,author:"Matt DesLauriers",license:"MIT",createdAt:"Tue, 30 May 2017 14:53:04 -0400",updatedAt:"Tue, 30 May 2017 14:53:04 -0400"},{name:"GlitchMemories",paramsTypes:{},defaultParams:{},glsl:`// author: Gunnar Roth // based on work from natewave // license: MIT vec4 transition(vec2 p) { vec2 block = floor(p.xy / vec2(16)); vec2 uv_noise = block / vec2(64); uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64); vec2 dist = progress > 0.0 ? (fract(uv_noise) - 0.5) * 0.3 *(1.0 -progress) : vec2(0.0); vec2 red = p + dist * 0.2; vec2 green = p + dist * .3; vec2 blue = p + dist * .5; return vec4(mix(getFromColor(red), getToColor(red), progress).r,mix(getFromColor(green), getToColor(green), progress).g,mix(getFromColor(blue), getToColor(blue), progress).b,1.0); } `,author:"Gunnar Roth",license:"MIT",createdAt:"Wed, 21 Feb 2018 00:52:15 +0100",updatedAt:"Wed, 21 Feb 2018 19:32:02 +0100"},{name:"GridFlip",paramsTypes:{size:"ivec2",pause:"float",dividerWidth:"float",bgcolor:"vec4",randomness:"float"},defaultParams:{size:[4,4],pause:.1,dividerWidth:.05,bgcolor:[0,0,0,1],randomness:.1},glsl:`// License: MIT // Author: TimDonselaar // ported by gre from https://gist.github.com/TimDonselaar/9bcd1c4b5934ba60087bdb55c2ea92e5 uniform ivec2 size; // = ivec2(4) uniform float pause; // = 0.1 uniform float dividerWidth; // = 0.05 uniform vec4 bgcolor; // = vec4(0.0, 0.0, 0.0, 1.0) uniform float randomness; // = 0.1 float rand (vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } float getDelta(vec2 p) { vec2 rectanglePos = floor(vec2(size) * p); vec2 rectangleSize = vec2(1.0 / vec2(size).x, 1.0 / vec2(size).y); float top = rectangleSize.y * (rectanglePos.y + 1.0); float bottom = rectangleSize.y * rectanglePos.y; float left = rectangleSize.x * rectanglePos.x; float right = rectangleSize.x * (rectanglePos.x + 1.0); float minX = min(abs(p.x - left), abs(p.x - right)); float minY = min(abs(p.y - top), abs(p.y - bottom)); return min(minX, minY); } float getDividerSize() { vec2 rectangleSize = vec2(1.0 / vec2(size).x, 1.0 / vec2(size).y); return min(rectangleSize.x, rectangleSize.y) * dividerWidth; } vec4 transition(vec2 p) { if(progress < pause) { float currentProg = progress / pause; float a = 1.0; if(getDelta(p) < getDividerSize()) { a = 1.0 - currentProg; } return mix(bgcolor, getFromColor(p), a); } else if(progress < 1.0 - pause){ if(getDelta(p) < getDividerSize()) { return bgcolor; } else { float currentProg = (progress - pause) / (1.0 - pause * 2.0); vec2 q = p; vec2 rectanglePos = floor(vec2(size) * q); float r = rand(rectanglePos) - randomness; float cp = smoothstep(0.0, 1.0 - r, currentProg); float rectangleSize = 1.0 / vec2(size).x; float delta = rectanglePos.x * rectangleSize; float offset = rectangleSize / 2.0 + delta; p.x = (p.x - offset)/abs(cp - 0.5)*0.5 + offset; vec4 a = getFromColor(p); vec4 b = getToColor(p); float s = step(abs(vec2(size).x * (q.x - delta) - 0.5), abs(cp - 0.5)); return mix(bgcolor, mix(b, a, step(cp, 0.5)), s); } } else { float currentProg = (progress - 1.0 + pause) / pause; float a = 1.0; if(getDelta(p) < getDividerSize()) { a = currentProg; } return mix(bgcolor, getToColor(p), a); } } `,license:"MIT",author:"TimDonselaar",createdAt:"Mon, 12 Jun 2017 11:32:51 +0800",updatedAt:"Mon, 12 Jun 2017 11:32:51 +0800"},{name:"InvertedPageCurl",paramsTypes:{},defaultParams:{},glsl:`// author: Hewlett-Packard // license: BSD 3 Clause // Adapted by Sergey Kosarevsky from: // http://rectalogic.github.io/webvfx/examples_2transition-shader-pagecurl_8html-example.html /* Copyright (c) 2010 Hewlett-Packard Development Company, L.P. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Hewlett-Packard nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. in vec2 texCoord; */ const float MIN_AMOUNT = -0.16; const float MAX_AMOUNT = 1.5; float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT; const float PI = 3.141592653589793; const float scale = 512.0; const float sharpness = 3.0; float cylinderCenter = amount; // 360 degrees * amount float cylinderAngle = 2.0 * PI * amount; const float cylinderRadius = 1.0 / PI / 2.0; vec3 hitPoint(float hitAngle, float yc, vec3 point, mat3 rrotation) { float hitPoint = hitAngle / (2.0 * PI); point.y = hitPoint; return rrotation * point; } vec4 antiAlias(vec4 color1, vec4 color2, float distanc) { distanc *= scale; if (distanc < 0.0) return color2; if (distanc > 2.0) return color1; float dd = pow(1.0 - distanc / 2.0, sharpness); return ((color2 - color1) * dd) + color1; } float distanceToEdge(vec3 point) { float dx = abs(point.x > 0.5 ? 1.0 - point.x : point.x); float dy = abs(point.y > 0.5 ? 1.0 - point.y : point.y); if (point.x < 0.0) dx = -point.x; if (point.x > 1.0) dx = point.x - 1.0; if (point.y < 0.0) dy = -point.y; if (point.y > 1.0) dy = point.y - 1.0; if ((point.x < 0.0 || point.x > 1.0) && (point.y < 0.0 || point.y > 1.0)) return sqrt(dx * dx + dy * dy); return min(dx, dy); } vec4 seeThrough(float yc, vec2 p, mat3 rotation, mat3 rrotation) { float hitAngle = PI - (acos(yc / cylinderRadius) - cylinderAngle); vec3 point = hitPoint(hitAngle, yc, rotation * vec3(p, 1.0), rrotation); if (yc <= 0.0 && (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0)) { return getToColor(p); } if (yc > 0.0) return getFromColor(p); vec4 color = getFromColor(point.xy); vec4 tcolor = vec4(0.0); return antiAlias(color, tcolor, distanceToEdge(point)); } vec4 seeThroughWithShadow(float yc, vec2 p, vec3 point, mat3 rotation, mat3 rrotation) { float shadow = distanceToEdge(point) * 30.0; shadow = (1.0 - shadow) / 3.0; if (shadow < 0.0) shadow = 0.0; else shadow *= amount; vec4 shadowColor = seeThrough(yc, p, rotation, rrotation); shadowColor.r -= shadow; shadowColor.g -= shadow; shadowColor.b -= shadow; return shadowColor; } vec4 backside(float yc, vec3 point) { vec4 color = getFromColor(point.xy); float gray = (color.r + color.b + color.g) / 15.0; gray += (8.0 / 10.0) * (pow(1.0 - abs(yc / cylinderRadius), 2.0 / 10.0) / 2.0 + (5.0 / 10.0)); color.rgb = vec3(gray); return color; } vec4 behindSurface(vec2 p, float yc, vec3 point, mat3 rrotation) { float shado = (1.0 - ((-cylinderRadius - yc) / amount * 7.0)) / 6.0; shado *= 1.0 - abs(point.x - 0.5); yc = (-cylinderRadius - cylinderRadius - yc); float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI; point = hitPoint(hitAngle, yc, point, rrotation); if (yc < 0.0 && point.x >= 0.0 && point.y >= 0.0 && point.x <= 1.0 && point.y <= 1.0 && (hitAngle < PI || amount > 0.5)) { shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / (71.0 / 100.0)); shado *= pow(-yc / cylinderRadius, 3.0); shado *= 0.5; } else { shado = 0.0; } return vec4(getToColor(p).rgb - shado, 1.0); } vec4 transition(vec2 p) { const float angle = 100.0 * PI / 180.0; float c = cos(-angle); float s = sin(-angle); mat3 rotation = mat3( c, s, 0, -s, c, 0, -0.801, 0.8900, 1 ); c = cos(angle); s = sin(angle); mat3 rrotation = mat3( c, s, 0, -s, c, 0, 0.98500, 0.985, 1 ); vec3 point = rotation * vec3(p, 1.0); float yc = point.y - cylinderCenter; if (yc < -cylinderRadius) { // Behind surface return behindSurface(p,yc, point, rrotation); } if (yc > cylinderRadius) { // Flat surface return getFromColor(p); } float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI; float hitAngleMod = mod(hitAngle, 2.0 * PI); if ((hitAngleMod > PI && amount < 0.5) || (hitAngleMod > PI/2.0 && amount < 0.0)) { return seeThrough(yc, p, rotation, rrotation); } point = hitPoint(hitAngle, yc, point, rrotation); if (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0) { return seeThroughWithShadow(yc, p, point, rotation, rrotation); } vec4 color = backside(yc, point); vec4 otherColor; if (yc < 0.0) { float shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / 0.71); shado *= pow(-yc / cylinderRadius, 3.0); shado *= 0.5; otherColor = vec4(0.0, 0.0, 0.0, shado); } else { otherColor = getFromColor(p); } color = antiAlias(color, otherColor, cylinderRadius - abs(yc)); vec4 cl = seeThroughWithShadow(yc, p, point, rotation, rrotation); float dist = distanceToEdge(point); return antiAlias(color, cl, dist); } `,author:"Hewlett-Packard",license:"BSD 3 Clause",createdAt:"Wed, 21 Feb 2018 01:13:49 +0100",updatedAt:"Wed, 21 Feb 2018 16:00:02 +0100"},{name:"LinearBlur",paramsTypes:{intensity:"float"},defaultParams:{intensity:.1},glsl:`// author: gre // license: MIT uniform float intensity; // = 0.1 const int passes = 6; vec4 transition(vec2 uv) { vec4 c1 = vec4(0.0); vec4 c2 = vec4(0.0); float disp = intensity*(0.5-distance(0.5, progress)); for (int xi=0; xi<passes; xi++) { float x = float(xi) / float(passes) - 0.5; for (int yi=0; yi<passes; yi++) { float y = float(yi) / float(passes) - 0.5; vec2 v = vec2(x,y); float d = disp; c1 += getFromColor( uv + d*v); c2 += getToColor( uv + d*v); } } c1 /= float(passes*passes); c2 /= float(passes*passes); return mix(c1, c2, progress); } `,author:"gre",license:"MIT",createdAt:"Fri, 23 Feb 2018 15:18:22 +0100",updatedAt:"Fri, 23 Feb 2018 15:18:22 +0100"},{name:"Mosaic",paramsTypes:{endx:"int",endy:"int"},defaultParams:{endx:2,endy:-1},glsl:`// License: MIT // Author: Xaychru // ported by gre from https://gist.github.com/Xaychru/130bb7b7affedbda9df5 #define PI 3.14159265358979323 #define POW2(X) X*X #define POW3(X) X*X*X uniform int endx; // = 2 uniform int endy; // = -1 float Rand(vec2 v) { return fract(sin(dot(v.xy ,vec2(12.9898,78.233))) * 43758.5453); } vec2 Rotate(vec2 v, float a) { mat2 rm = mat2(cos(a), -sin(a), sin(a), cos(a)); return rm*v; } float CosInterpolation(float x) { return -cos(x*PI)/2.+.5; } vec4 transition(vec2 uv) { vec2 p = uv.xy / vec2(1.0).xy - .5; vec2 rp = p; float rpr = (progress*2.-1.); float z = -(rpr*rpr*2.) + 3.; float az = abs(z); rp *= az; rp += mix(vec2(.5, .5), vec2(float(endx) + .5, float(endy) + .5), POW2(CosInterpolation(progress))); vec2 mrp = mod(rp, 1.); vec2 crp = rp; bool onEnd = int(floor(crp.x))==endx&&int(floor(crp.y))==endy; if(!onEnd) { float ang = float(int(Rand(floor(crp))*4.))*.5*PI; mrp = vec2(.5) + Rotate(mrp-vec2(.5), ang); } if(onEnd || Rand(floor(crp))>.5) { return getToColor(mrp); } else { return getFromColor(mrp); } } `,license:"MIT",author:"Xaychru",createdAt:"Mon, 12 Jun 2017 10:26:51 +0800",updatedAt:"Mon, 12 Jun 2017 10:26:51 +0800"},{name:"PolkaDotsCurtain",paramsTypes:{dots:"float",center:"vec2"},defaultParams:{dots:20,center:[0,0]},glsl:`// author: bobylito // license: MIT const float SQRT_2 = 1.414213562373; uniform float dots;// = 20.0; uniform vec2 center;// = vec2(0, 0); vec4 transition(vec2 uv) { bool nextImage = distance(fract(uv * dots), vec2(0.5, 0.5)) < ( progress / distance(uv, center)); return nextImage ? getToColor(uv) : getFromColor(uv); } `,author:"bobylito",license:"MIT",createdAt:"Tue, 20 Feb 2018 23:41:45 +0100",updatedAt:"Tue, 20 Feb 2018 23:41:45 +0100"},{name:"Radial",paramsTypes:{smoothness:"float"},defaultParams:{smoothness:1},glsl:`// License: MIT // Author: Xaychru // ported by gre from https://gist.github.com/Xaychru/ce1d48f0ce00bb379750 uniform float smoothness; // = 1.0 const float PI = 3.141592653589; vec4 transition(vec2 p) { vec2 rp = p*2.-1.; return mix( getToColor(p), getFromColor(p), smoothstep(0., smoothness, atan(rp.y,rp.x) - (progress-.5) * PI * 2.5) ); } `,license:"MIT",author:"Xaychru",createdAt:"Mon, 12 Jun 2017 10:36:24 +0800",updatedAt:"Mon, 12 Jun 2017 10:36:24 +0800"},{name:"SimpleZoom",paramsTypes:{zoom_quickness:"float"},defaultParams:{zoom_quickness:.8},glsl:`// Author: 0gust1 // License: MIT uniform float zoom_quickness; // = 0.8 float nQuick = clamp(zoom_quickness,0.2,1.0); vec2 zoom(vec2 uv, float amount) { return 0.5 + ((uv - 0.5) * (1.0-amount)); } vec4 transition (vec2 uv) { return mix( getFromColor(zoom(uv, smoothstep(0.0, nQuick, progress))), getToColor(uv), smoothstep(nQuick-0.2, 1.0, progress) ); }`,author:"0gust1",license:"MIT",createdAt:"Tue, 6 Mar 2018 00:43:47 +0100",updatedAt:"Tue, 6 Mar 2018 00:43:47 +0100"},{name:"StereoViewer",paramsTypes:{zoom:"float",corner_radius:"float"},defaultParams:{zoom:.88,corner_radius:.22},glsl:`// Tunable parameters // How much to zoom (out) for the effect ~ 0.5 - 1.0 uniform float zoom; // = 0.88 // Corner radius as a fraction of the image height uniform float corner_radius; // = 0.22 // author: Ted Schundler // license: BSD 2 Clause // Free for use and modification by anyone with credit // Copyright (c) 2016, Theodore K Schundler // All rights reserved. // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /////////////////////////////////////////////////////////////////////////////// // Stereo Viewer Toy Transition // // // // Inspired by ViewMaster / Image3D image viewer devices. // // This effect is similar to what you see when you press the device's lever. // // There is a quick zoom in / out to make the transition 'valid' for GLSL.io // /////////////////////////////////////////////////////////////////////////////// const vec4 black = vec4(0.0, 0.0, 0.0, 1.0); const vec2 c00 = vec2(0.0, 0.0); // the four corner points const vec2 c01 = vec2(0.0, 1.0); const vec2 c11 = vec2(1.0, 1.0); const vec2 c10 = vec2(1.0, 0.0); // Check if a point is within a given corner bool in_corner(vec2 p, vec2 corner, vec2 radius) { // determine the direction we want to be filled vec2 axis = (c11 - corner) - corner; // warp the point so we are always testing the bottom left point with the // circle centered on the origin p = p - (corner + axis * radius); p *= axis / radius; return (p.x > 0.0 && p.y > -1.0) || (p.y > 0.0 && p.x > -1.0) || dot(p, p) < 1.0; } // Check all four corners // return a float for v2 for anti-aliasing? bool test_rounded_mask(vec2 p, vec2 corner_size) { return in_corner(p, c00, corner_size) && in_corner(p, c01, corner_size) && in_corner(p, c10, corner_size) && in_corner(p, c11, corner_size); } // Screen blend mode - https://en.wikipedia.org/wiki/Blend_modes // This more closely approximates what you see than linear blending vec4 screen(vec4 a, vec4 b) { return 1.0 - (1.0 - a) * (1.0 -b); } // Given RGBA, find a value that when screened with itself // will yield the original value. vec4 unscreen(vec4 c) { return 1.0 - sqrt(1.0 - c); } // Grab a pixel, only if it isn't masked out by the rounded corners vec4 sample_with_corners_from(vec2 p, vec2 corner_size) { p = (p - 0.5) / zoom + 0.5; if (!test_rounded_mask(p, corner_size)) { return black; } return unscreen(getFromColor(p)); } vec4 sample_with_corners_to(vec2 p, vec2 corner_size) { p = (p - 0.5) / zoom + 0.5; if (!test_rounded_mask(p, corner_size)) { return black; } return unscreen(getToColor(p)); } // special sampling used when zooming - extra zoom parameter and don't unscreen vec4 simple_sample_with_corners_from(vec2 p, vec2 corner_size, float zoom_amt) { p = (p - 0.5) / (1.0 - zoom_amt + zoom * zoom_amt) + 0.5; if (!test_rounded_mask(p, corner_size)) { return black; } return getFromColor(p); } vec4 simple_sample_with_corners_to(vec2 p, vec2 corner_size, float zoom_amt) { p = (p - 0.5) / (1.0 - zoom_amt + zoom * zoom_amt) + 0.5; if (!test_rounded_mask(p, corner_size)) { return black; } return getToColor(p); } // Basic 2D affine transform matrix helpers // These really shouldn't be used in a fragment shader - I should work out the // the math for a translate & rotate function as a pair of dot products instead mat3 rotate2d(float angle, float ratio) { float s = sin(angle); float c = cos(angle); return mat3( c, s ,0.0, -s, c, 0.0, 0.0, 0.0, 1.0); } mat3 translate2d(float x, float y) { return mat3( 1.0, 0.0, 0, 0.0, 1.0, 0, -x, -y, 1.0); } mat3 scale2d(float x, float y) { return mat3( x, 0.0, 0, 0.0, y, 0, 0, 0, 1.0); } // Split an image and rotate one up and one down along off screen pivot points vec4 get_cross_rotated(vec3 p3, float angle, vec2 corner_size, float ratio) { angle = angle * angle; // easing angle /= 2.4; // works out to be a good number of radians mat3 center_and_scale = translate2d(-0.5, -0.5) * scale2d(1.0, ratio); mat3 unscale_and_uncenter = scale2d(1.0, 1.0/ratio) * translate2d(0.5,0.5); mat3 slide_left = translate2d(-2.0,0.0); mat3 slide_right = translate2d(2.0,0.0); mat3 rotate = rotate2d(angle, ratio); mat3 op_a = center_and_scale * slide_right * rotate * slide_left * unscale_and_uncenter; mat3 op_b = center_and_scale * slide_left * rotate * slide_right * unscale_and_uncenter; vec4 a = sample_with_corners_from((op_a * p3).xy, corner_size); vec4 b = sample_with_corners_from((op_b * p3).xy, corner_size); return screen(a, b); } // Image stays put, but this time move two masks vec4 get_cross_masked(vec3 p3, float angle, vec2 corner_size, float ratio) { angle = 1.0 - angle; angle = angle * angle; // easing angle /= 2.4; vec4 img; mat3 center_and_scale = translate2d(-0.5, -0.5) * scale2d(1.0, ratio); mat3 unscale_and_uncenter = scale2d(1.0 / zoom, 1.0 / (zoom * ratio)) * translate2d(0.5,0.5); mat3 slide_left = translate2d(-2.0,0.0); mat3 slide_right = translate2d(2.0,0.0); mat3 rotate = rotate2d(angle, ratio); mat3 op_a = center_and_scale * slide_right * rotate * slide_left * unscale_and_uncenter; mat3 op_b = center_and_scale * slide_left * rotate * slide_right * unscale_and_uncenter; bool mask_a = test_rounded_mask((op_a * p3).xy, corner_size); bool mask_b = test_rounded_mask((op_b * p3).xy, corner_size); if (mask_a || mask_b) { img = sample_with_corners_to(p3.xy, corner_size); return screen(mask_a ? img : black, mask_b ? img : black); } else { return black; } } vec4 transition(vec2 uv) { float a; vec2 p=uv.xy/vec2(1.0).xy; vec3 p3 = vec3(p.xy, 1.0); // for 2D matrix transforms // corner is warped to represent to size after mapping to 1.0, 1.0 vec2 corner_size = vec2(corner_radius / ratio, corner_radius); if (progress <= 0.0) { // 0.0: start with the base frame always return getFromColor(p); } else if (progress < 0.1) { // 0.0-0.1: zoom out and add rounded corners a = progress / 0.1; return simple_sample_with_corners_from(p, corner_size * a, a); } else if (progress < 0.48) { // 0.1-0.48: Split original image apart a = (progress - 0.1)/0.38; return get_cross_rotated(p3, a, corner_size, ratio); } else if (progress < 0.9) { // 0.48-0.52: black // 0.52 - 0.9: unmask new image return get_cross_masked(p3, (progress - 0.52)/0.38, corner_size, ratio); } else if (progress < 1.0) { // zoom out and add rounded corners a = (1.0 - progress) / 0.1; return simple_sample_with_corners_to(p, corner_size * a, a); } else { // 1.0 end with base frame return getToColor(p); } } `,author:"Ted Schundler",license:"BSD 2 Clause",createdAt:"Tue, 20 Feb 2018 23:20:29 +0100",updatedAt:"Wed, 21 Feb 2018 15:42:00 +0100"},{name:"Swirl",paramsTypes:{},defaultParams:{},glsl:`// 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 ); } `,license:"MIT",author:"Sergey Kosarevsky",createdAt:"Mon, 12 Jun 2017 12:38:27 +0800",updatedAt:"Mon, 12 Jun 2017 12:38:27 +0800"},{name:"WaterDrop",paramsTypes:{amplitude:"float",speed:"float"},defaultParams:{amplitude:30,speed:30},glsl:`// author: Pawe\u0142 P\u0142\xF3ciennik // license: MIT uniform float amplitude; // = 30 uniform float speed; // = 30 vec4 transition(vec2 p) { vec2 dir = p - vec2(.5); float dist = length(dir); if (dist > progress) { return mix(getFromColor( p), getToColor( p), progress); } else { vec2 offset = dir * sin(dist * amplitude - progress * speed); return mix(getFromColor( p + offset), getToColor( p), progress); } } `,author:"Pawe\u0142 P\u0142\xF3ciennik",license:"MIT",createdAt:"Wed, 21 Feb 2018 19:37:15 +0100",updatedAt:"Wed, 21 Feb 2018 19:37:15 +0100"},{name:"ZoomInCircles",paramsTypes:{},defaultParams:{},glsl:`// License: MIT // Author: dycm8009 // ported by gre from https://gist.github.com/dycm8009/948e99b1800e81ad909a vec2 zoom(vec2 uv, float amount) { return 0.5 + ((uv - 0.5) * amount); } vec2 ratio2 = vec2(1.0, 1.0 / ratio); vec4 transition(vec2 uv) { // TODO: some timing are hardcoded but should be one or many parameters // TODO: should also be able to configure how much circles // TODO: if() branching should be avoided when possible, prefer use of step() & other functions vec2 r = 2.0 * ((vec2(uv.xy) - 0.5) * ratio2); float pro = progress / 0.8; float z = pro * 0.2; float t = 0.0; if (pro > 1.0) { z = 0.2 + (pro - 1.0) * 5.; t = clamp((progress - 0.8) / 0.07, 0.0, 1.0); } if (length(r) < 0.5+z) { // uv = zoom(uv, 0.9 - 0.1 * pro); } else if (length(r) < 0.8+z*1.5) { uv = zoom(uv, 1.0 - 0.15 * pro); t = t * 0.5; } else if (length(r) < 1.2+z*2.5) { uv = zoom(uv, 1.0 - 0.2 * pro); t = t * 0.2; } else { uv = zoom(uv, 1.0 - 0.25 * pro); } return mix(getFromColor(uv), getToColor(uv), t); } `,license:"MIT",author:"dycm8009",createdAt:"Mon, 12 Jun 2017 11:24:34 +0800",updatedAt:"Mon, 12 Jun 2017 11:24:34 +0800"},{name:"angular",paramsTypes:{startingAngle:"float"},defaultParams:{startingAngle:90},glsl:`// Author: Fernando Kuteken // License: MIT #define PI 3.141592653589 uniform float startingAngle; // = 90; vec4 transition (vec2 uv) { float offset = startingAngle * PI / 180.0; float angle = atan(uv.y - 0.5, uv.x - 0.5) + offset; float normalizedAngle = (angle + PI) / (2.0 * PI); normalizedAngle = normalizedAngle - floor(normalizedAngle); return mix( getFromColor(uv), getToColor(uv), step(normalizedAngle, progress) ); } `,author:"Fernando Kuteken",license:"MIT",createdAt:"Tue, 30 May 2017 14:26:44 +0200",updatedAt:"Tue, 30 May 2017 14:26:44 +0200"},{name:"burn",paramsTypes:{color:"vec3"},defaultParams:{color:[.9,.4,.2]},glsl:`// author: gre // License: MIT uniform vec3 color /* = vec3(0.9, 0.4, 0.2) */; vec4 transition (vec2 uv) { return mix( getFromColor(uv) + vec4(progress*color, 1.0), getToColor(uv) + vec4((1.0-progress)*color, 1.0), progress ); } `,author:"gre",license:"MIT",createdAt:"Tue, 30 May 2017 14:26:44 +0200",updatedAt:"Tue, 30 May 2017 14:26:44 +0200"},{name:"cannabisleaf",paramsTypes:{},defaultParams:{},glsl:`// Author: @Flexi23 // License: MIT // inspired by http://www.wolframalpha.com/input/?i=cannabis+curve vec4 transition (vec2 uv) { if(progress == 0.0){ return getFromColor(uv); } vec2 leaf_uv = (uv - vec2(0.5))/10./pow(progress,3.5); leaf_uv.y += 0.35; float r = 0.18; float o = atan(leaf_uv.y, leaf_uv.x); return mix(getFromColor(uv), getToColor(uv), 1.-step(1. - length(leaf_uv)+r*(1.+sin(o))*(1.+0.9 * cos(8.*o))*(1.+0.1*cos(24.*o))*(0.9+0.05*cos(200.*o)), 1.)); } `,author:"@Flexi23",license:"MIT",createdAt:"Thu, 1 Jun 2017 15:58:58 +0200",updatedAt:"Thu, 1 Jun 2017 15:58:58 +0200"},{name:"circle",paramsTypes:{center:"vec2",backColor:"vec3"},defaultParams:{center:[.5,.5],backColor:[.1,.1,.1]},glsl:`// Author: Fernando Kuteken // License: MIT uniform vec2 center; // = vec2(0.5, 0.5); uniform vec3 backColor; // = vec3(0.1, 0.1, 0.1); vec4 transition (vec2 uv) { float distance = length(uv - center); float radius = sqrt(8.0) * abs(progress - 0.5); if (distance > radius) { return vec4(backColor, 1.0); } else { if (progress < 0.5) return getFromColor(uv); else return getToColor(uv); } } `,author:"Fernando Kuteken",license:"MIT",createdAt:"Tue, 30 May 2017 14:26:44 +0200",updatedAt:"Tue, 30 May 2017 14:26:44 +0200"},{name:"circleopen",paramsTypes:{smoothness:"float",opening:"bool"},defaultParams:{smoothness:.3,opening:!0},glsl:`// author: gre // License: MIT uniform float smoothness; // = 0.3 uniform bool opening; // = true const vec2 center = vec2(0.5, 0.5); const float SQRT_2 = 1.414213562373; vec4 transition (vec2 uv) { float x = opening ? progress : 1.-progress; float m = smoothstep(-smoothness, 0.0, SQRT_2*distance(center, uv) - x*(1.+smoothness)); return mix(getFromColor(uv), getToColor(uv), opening ? 1.-m : m); } `,author:"gre",license:"MIT",createdAt:"Tue, 30 May 2017 14:26:44 +0200",updatedAt:"Tue, 30 May 2017 14:26:44 +0200"},{name:"colorphase",paramsTypes:{fromStep:"vec4",toStep:"vec4"},defaultParams:{fromStep:[0,.2,.4,0],toStep:[.6,.8,1,1]},glsl:`// Author: gre // License: MIT // Usage: fromSt