Teleport animation

This commit is contained in:
MaddoScientisto 2025-02-22 14:45:46 +01:00
commit 4a8ac7a495
8 changed files with 269 additions and 5 deletions

21
Shaders/Blink.gdshader Normal file
View file

@ -0,0 +1,21 @@
shader_type canvas_item;
uniform vec4 blink_color: source_color;
uniform float blink_intensity = 0.0;
uniform float teleport_progress = 0.0; // 0 = fully visible, 1 = fully gone
uniform float scanline_density = 50.0; // Controls the number of scanlines
void fragment() {
vec4 color = texture(TEXTURE, UV);
color = mix(color, blink_color, blink_intensity * color.a);
// Generate scanline effect based on teleport_progress
float scanline = mod(UV.y * scanline_density, 1.0); // Creates scanline pattern
float cutoff = smoothstep(0.0, 1.0, UV.y - teleport_progress); // Controls disappearance
// Mix scanline effect with cutoff to make it gradually disappear
float alpha_multiplier = step(scanline, cutoff);
color.a *= alpha_multiplier;
COLOR = color;
}