transparency and motion question

quick question… how can i make it so as an object (or camera) gets closer to an object it becomes more transparent and as i move farther away less?

sry nvm i figured it out…