-
-
Save gre/8609071 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifdef GL_ES | |
| precision highp float; | |
| #endif | |
| // General parameters | |
| uniform sampler2D from; | |
| uniform sampler2D to; | |
| uniform float progress; | |
| uniform vec2 resolution; | |
| uniform float smoothness; | |
| uniform bool opening; | |
| const vec2 center = vec2(0.5, 0.5); | |
| const float SQRT_2 = 1.414213562373; | |
| void main() { | |
| vec2 p = gl_FragCoord.xy / resolution.xy; | |
| float x = opening ? progress : 1.-progress; | |
| float m = smoothstep(-smoothness, 0.0, SQRT_2*distance(center, p) - x*(1.+smoothness)); | |
| gl_FragColor = mix(texture2D(from, p), texture2D(to, p), opening ? 1.-m : m); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { "opening": true, "smoothness": 0.3 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment