oops
[edit]
I think I've cracked it in one function.
Syntax dollyzoom(distanc#,duration)
Distance is how far the camera will move each step.
Duration tells the function how many steps to run for.
The FOV is counter-balanced to keep the focal object roughly the same size in the frame.
rem Program Name: Dolly Zoom
rem Author: OBese87
rem Date: 23/10/2009
rem Edited: 10/02/2010
rem ==================
set display mode 1024,768,32
hide mouse
sync rate 60
sync on
dim fov#(0)
gosub make_scene
rem === MAIN ===
gosub setup_camera
dollyzoom(-0.08,250)
gosub setup_camera
color backdrop 0
dollyzoom(-0.5,50)
dollyzoom(0.5,50)
end
rem === SUBROUTINES ===
make_scene:
for ob = 0 to 48
make object cube ob+1,1
yrotate object ob+1,45
xrotate object ob+1,45
position object ob+1,(ob/7)*4,(ob-(ob/7)*7)*4,0
color object ob+1,rgb(255,0,0)
next ob
for ob = 0 to 48
make object cube ob+50,1
yrotate object ob+50,45
xrotate object ob+50,45
position object ob+50,(ob/7)*4,(ob-(ob/7)*7)*4,4
color object ob+50,rgb(255,255,0)
next ob
for ob = 0 to 48
make object cube ob+100,1
yrotate object ob+100,45
xrotate object ob+100,45
position object ob+100,(ob/7)*4,(ob-(ob/7)*7)*4,8
color object ob+100,rgb(0,255,0)
next ob
return
`//
setup_camera:
position camera 12,12,-10
point camera 12,12,0
fov#(0)=1.2
set camera fov fov#(0)
return
`//
rem === FUNCTIONS ===
function dollyzoom(distance#, duration)
fovscaler# = 10/distance#
for i = 1 to duration
set cursor 0,0:print screen fps()
move camera distance#
fov#(0) = fov#(0) + fov#(0)/fovscaler#
set camera fov fov#(0)
next i
endfunction
`//
"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright