How to animate weight-painting?
I think you're looking for the Vertex Weight Proximity modifier. It lets you assign vertex weights based on, for example, the distance to the target object's geometry, which you can animate per usual.