GMS 2 Help with smooth camera zoom perhaps?

So I'm not every good with math (at all) and im trying to get a gentle zoom with my camera system.
Basically its a 2D platformer and whenever I go into a large room (like a boss fight or something of that nature) I need the camera to zoom out. I already have a pretty good camera system set up, but i need a way to smoothly transition from 480x270 (the base camera size that is used everywhere else in the game other than big rooms) to something higher (but obviously still keep the aspect ratio because otherwise it would be extra gross). I can already set the camera size with camera_set_view_size but i need it to be smoother than that which I would assume involves some maths. Also I have bad grammar but that can't be helped here.
 

trentallain

Member
So I'm not every good with math (at all) and im trying to get a gentle zoom with my camera system.
Basically its a 2D platformer and whenever I go into a large room (like a boss fight or something of that nature) I need the camera to zoom out. I already have a pretty good camera system set up, but i need a way to smoothly transition from 480x270 (the base camera size that is used everywhere else in the game other than big rooms) to something higher (but obviously still keep the aspect ratio because otherwise it would be extra gross). I can already set the camera size with camera_set_view_size but i need it to be smoother than that which I would assume involves some maths. Also I have bad grammar but that can't be helped here.
xwidth = lerp(xwidth,xwidth_target)
Same for ywidth.
(They are made up variables, what I'm saying is use lerp haha)
 
Top