This shader displays two sets of bars that come in from opposite sides of the screen and cross each other to cover the screen. It could be used as a scene transition.

https://gfycat.com/SimplePoliteHummingbirdHere are the properties of the shader that you can set:

enabled (bool) -- This is used to control whether most of the shader code is run. It's useful if you want to disable the shader without needing to reapply shaders. If not using the custom block it defaults to false so you'll need to set it to true first.

counter (float) -- This controls the current position of the shader and it must be 0 or higher. Set this under the always/updating event or in a timer. Increase to move the bars in and decrease to move the bars out. The example GIF changes the counter by + or - 8 every 0.01 seconds.

direction (float) -- This is the direction (in degrees) that the first set of bars will move. The second set moves in the opposite direction. (range: 0-360)

barWidth(float) -- This is the width of each bar.

red(float) -- This is the red value of the bars. (range: 0-1)

green(float) -- This is the green value of the bars. (range: 0-1)

blue(float) -- This is the blue value of the bars. (range: 0-1)

**Shadertoy Code**`bool enabled = true;`

float counter = 0.0;

float direction = 45.0;

float barWidth = 20.0;

float red = 0.1;

float green = 0.2;

float blue = 0.4;

void mainImage(out vec4 fragColor, in vec2 fragCoord)

{

vec2 uv = fragCoord.xy / iResolution.xy;

vec4 tex = texture(iChannel0, uv);

if (!enabled)

{

fragColor = tex;

return;

}

vec2 res = vec2(iResolution.xy);

float rad = radians(direction);

float s = sin(rad + radians(180.0));

float c = cos(rad);

float start = res.x * abs(c) + res.y * abs(s);

if (false) // for testing: false = transition out and true = transition in

{

counter = start - iGlobalTime * 500.0;

}

else

{

counter = iGlobalTime * 500.0;

}

float x = fragCoord.x;

float y = fragCoord.y;

float startX = x;

float startY = y;

if (direction >= 0.0 && direction < 90.0)

{

startY = y - res.y;

}

else if (direction >= 90.0 && direction < 180.0)

{

startX = x - res.x;

startY = y - res.y;

}

else if (direction >= 180.0 && direction < 270.0)

{

startX = x - res.x;

}

else

{

// no changes between 270.0 and 360.0

}

float offset = res.x * 2.0; // avoids inconsistent bars

float rowFloat = abs((x + offset) * s - y * c) / barWidth;

int row = int(floor(rowFloat));

if (counter > abs(startX * c) + abs(startY * s) && row % 2 == 0)

{

fragColor = vec4(red, green, blue, 1.0);

}

else if (abs(res.x * c) + abs(res.y * s) - counter < abs(startX * c) + abs(startY * s) && row % 2 == 1)

{

fragColor = vec4(red, green, blue, 1.0);

}

else

{

fragColor = vec4(tex);

}

}

**Stencyl Code**`#ifdef GL_ES`

precision mediump float;

#endif

varying vec2 vTexCoord;

uniform vec2 uResolution;

uniform vec2 uResolutionUs;

uniform sampler2D uImage0;

uniform bool enabled;

uniform float counter;

uniform float direction;

uniform float barWidth;

uniform float red;

uniform float green;

uniform float blue;

void main()

{

vec2 uv = vTexCoord;

vec4 tex = texture2D(uImage0, uv);

if (!enabled)

{

gl_FragColor = tex;

return;

}

vec2 res = uResolution;

float scale = res.x / uResolutionUs.x;

float rad = radians(direction);

float s = sin(rad + radians(180.0));

float c = cos(rad);

float start = res.x * abs(c) + res.y * abs(s);

float x = uv.x * res.x;

float y = uv.y * res.y;

float startX = x;

float startY = y;

if (direction >= 0.0 && direction < 90.0)

{

startY = y - res.y;

}

else if (direction >= 90.0 && direction < 180.0)

{

startX = x - res.x;

startY = y - res.y;

}

else if (direction >= 180.0 && direction < 270.0)

{

startX = x - res.x;

}

else

{

// no changes between 270.0 and 360.0

}

float offset = res.x * 2.0; // avoids inconsistent bars

float rowFloat = abs((x + offset) * s - y * c) / (barWidth * scale);

int row = int(floor(rowFloat));

if (counter * scale > abs(startX * c) + abs(startY * s) && row % 2 == 0)

{

gl_FragColor = vec4(red, green, blue, 1.0);

}

else if (abs(res.x * c) + abs(res.y * s) - counter * scale < abs(startX * c) + abs(startY * s) && row % 2 == 1)

{

gl_FragColor = vec4(red, green, blue, 1.0);

}

else

{

gl_FragColor = vec4(tex);

}

}