How to draw gradient by mask

I’m making a RMBK-1000 reactor simulation, i want to dynamically draw gradient of temperature in pipes
I already did mask for tubes but how do i draw gradient by mask so it goes from active zone to steam separator, and from separator to turbines and after condenser where becomes water and returns to separator where it goes back to active zone.

Image:

Mask:

Sorry if my english was bad.

Hi @LedForm !

If you change your mask texture a bit, you can put animation information in there.
E.g. it’s common to encode “time” into a mask, encoded as a gradient from black to white.

You’d pass in a value to your shader, like “time” and use the gradient value to choose correct color in the shader.

Example using masks to animate stencil fades: