For anyone who was still searching for a solution to this (like me) as there is no easy way to do this exact thing yet, here is my solution:
- Add a new ShaderMaterial to the Sprite you want to flash (if it
already has a shader attached you can just add the code below to
it).
- Add a new Shader (not VisualShader) to the material.
- Open the shader and add the following code:
.
shader_type canvas_item;
uniform float white_progress : hint_range(0,1) = 0;
vec3 interpolate_vec3(vec3 start, vec3 end, float delta){
return start + (end - start) * delta;
}
void fragment(){
vec4 origin = texture(TEXTURE, UV);
COLOR.rgb = interpolate_vec3(origin.rgb, vec3(1,1,1), white_progress);
COLOR.a = origin.a;
}
Now you can use an AnimationPlayer to change the "white_progress" in "Shader Param" to create a flashing sprite.