Gradient material along spline

Well I don’t mean to prepare a fixed number of assets. I want to move a gradient mask along a spline - whatever the length or the path of the spline. I want to simulate a liquid flowing into a tube.