Wipe Shader (4.0.3)

Wipes image horizontal / vertical with custom alphas

 

 

Godot 4.0.3

Shader code
shader_type canvas_item;

uniform float percentage:hint_range(0.0,1,.01);
uniform float masked_alpha:hint_range(0,1,.01)=1;
uniform float unmasked_alpha:hint_range(0,1,.01);

uniform bool horizontal=false;
uniform bool invert=true;



void fragment() {
	vec4 main_tex=texture(TEXTURE,UV);
	COLOR.a=main_tex.a;
	
	float uvPOS=UV.y;
	float step_value=unmasked_alpha+step(uvPOS,percentage);
	
	if(horizontal){ uvPOS=UV.x; }
	if(invert){
		step_value=unmasked_alpha+1.0-step(uvPOS,percentage);
	}
	

	COLOR.a=(main_tex.a)*step_value*masked_alpha;
}
Tags
crop, image, mask, wipe
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Multi-Frame Wipe

Port of “An introduction to Shader Art Coding” by kishimisu

Mana Resource Orb Shader

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments