Back to shaders
Shader test bench
Window Blinds.fs
runnable fragment
Complete GLSL fragment shader. Stronghold runs it directly when the browser can compile it.
Code
uniform sampler2D startImage;
uniform sampler2D endImage;
uniform float progress;
precision mediump float;
/*
{
"CATEGORIES" : [
"Dissolve"
],
"INPUTS" : [
{
"TYPE" : "image",
"NAME" : "startImage"
},
{
"NAME" : "endImage",
"TYPE" : "image"
},
{
"NAME" : "progress",
"MIN" : 0,
"TYPE" : "float",
"MAX" : 1,
"DEFAULT" : 0
}
],
"CREDIT": "Automatically converted from https://www.github.com/gl-transitions/gl-transitions/tree/master/windowblinds.glsl",
"DESCRIPTION": "",
"ISFVSN" : "2"
}
*/
vec4 getFromColor(vec2 inUV) {
return texture2D(startImage, inUV);
}
vec4 getToColor(vec2 inUV) {
return texture2D(endImage, inUV);
}
// Author: Fabien Benetou
// License: MIT
vec4 transition (vec2 uv) {
float t = progress;
if (mod(floor(uv.y*100.*progress),2.)==0.)
t*=2.-.5;
return mix(
getFromColor(uv),
getToColor(uv),
mix(t, progress, smoothstep(0.8, 1.0, progress))
);
}
void main() {
gl_FragColor = transition((gl_FragCoord.xy / u_resolution.xy).xy);
}