There are camera zoom functions however what you want is actually saved views.
Set your camera to the desired position and run the SaveView API.
You can use numbers 2-5. 1 is reserved and can't be overriden (1 is first person view).
Once you've saved the view, you can access it again by running the SetView API.
In this case you could use 1-5, however 1 will always be first person.
I'm not 100% sure, but I believe you may also be able to set keybindings to these views.
Do not toggle the camera factors or distance after saving your views, just toggle the view to the appropriate distance. Simple way to do it...
Set your 2 to like 10 yards, 3 to like 20 yards, 4 to like 30 yards, and 5 to maximum distance.
World of Warcraft API, Camera Functions
"In anything, if you want to go from just a beginner to a pro, you need a montage." /w TankSpot WTB Montage for Raiders.