How to gradually reveal a sprite?

Godot Version

Latest (4.7.2 at this time)

Question

Let’s say I have a sprite of a curvy line:

image

Here the line is on a white background, but in the game it would be on a transparent background, layered on top of other things.

Now I want that line to be invisible at first, and then gradually get revealed, as if someone was drawing it with an invisible pen. This is done in 2D. How would I achieve such an effect, in principle? I can work out the details myself, but I don’t even see from which direction to attack this problem in Godot.

With shaders you can use colors as data, draw a gradient along the line to encode it’s reveal.

Here’s a tool to help generate such effect from an SVG file, including a tutorial and shader to use