I’m not at home, so I can’t check that code myself to try helping with it, but I’m assuming it uses tweening and probably HeartBeat to make a smoother transition between camera zoom positions.
This is false – you can totally override TweenService tweens by starting another tween on that same object with overlapping parameters. No need to explicitly cancel the previous tween either.
I’m not sure whether this would work in a gui, but this is how I did it in my model showcase game using the camera.
zoom = 8.5 -- or whatever you want it to start at
uis.InputChanged:Connect(function(input, gp)
if gp then return end
if input.UserInputType == Enum.UserInputType.MouseWheel then
if input.Position.Z == -1 then
for i = 1, 10 do
if zoom + 0.1 < 13 then
zoom = zoom + 0.1
wait()
else
break
end
end
else
for i = 1, 10 do
if zoom - 0.1 > 4 then
zoom = zoom - 0.1
wait()
else
break
end
end
end
end
end)
The < 13 and >4 just sets limits so you can’t zoom in/out too far.
Then I use RenderStepped to actually set the camera’s CFrame.
“Tween” usually means a static animation, which this isn’t.
We modeled camera zoom as a critically damped spring to preserve continuity and avoid jarring velocity changes. That is the function of the ConstrainedSpring logic in ZoomController.
I see. Still at work, so I have yet to see it myself to see how it works, but @subcritical explained what method was used. Just gotta traverse that portion of the camera code to find the logic behind it to apply it for your needs.