In the material, this sort of setup
A and B will be the two greens.
Maxdistance is the camera distance at which you want it to be fully B.