Animating a material change along an axis of a mesh Imagine a long cube, like a bar, that has a dark material, and you want to animate changing its material to a light material, but do it gradually from one end to the other, like filling up a tube, or like a progress bar that fills from one end to the other.
How can you do this in Blender?
Something like this ?



The principle is to mix your materials (the mix shader factor) upon a coordinate of your object.
Here I set the first key frame to -3 meters for X and the last one to 3 meters for X (I dont know why these values work, I had to try to find them...).

Edit : the blend file

Edit 2 : to make the transition sharper, add a "math/less than" node, as shown here