Code archives/3D Graphics - Effects/Gradually shrink camera viewport.

This code has been declared by its author to be Public Domain code.

Download source code

Gradually shrink camera viewport. by Zethrax2004
The first function gradually shrinks the camera viewport(s) to give the effect that the viewport is moving away from you. The aspect ratio of the viewport is preserved as it shrinks. You can specify a parameter (in seconds) which determines how long the shrinking process takes.

The effect is probably best suited to end of game, or death, scenes.

This function is meant to be used as a self contained routine, but it could be adapted to work as inline code in your main loop. You could also adapt it for use with 2D viewports.

The second function simply resets the viewport(s) to the specified size. If you only had one viewport to reset and no 'tidy up' rendering to do then you could simply use the 'CameraViewport' command directly.

; The code is at: http://www.blitzbasic.com/codearcs/codearcs.php?code=909

Comments

asdfasdf2004
It doesn't do any thing


Zethrax2004
Sorry, there's no example code in there so it won't do anything by itself. The code is heavily commented so you should be able to work out how to use it by reading through it, though.

In the first function above, the lines:-

CameraViewport camera_1, x#, y#, w#, h# ; Changes the viewport size of your main camera.
CameraViewport HUD_camera, x#, y#, w#, h# ; Changes the viewport size of your HUD camera, if you've got one. Remove if not.

should be edited so that the names for the camera handles (camera_1 and HUD_camera in the code above) are the same as the ones you use in your code. Remove the second line above if you don't have a second camera. Do the same in the second function.

I'll add an example and some more detailed comments sometime soon.


Code Archives Forum