ID:272696
 
Hi, I'm wondering how to get the user's view to zoom in/out smoothly.

Just now, to test, I have a macro for + and - which enlarges or shrinks the usr.client.view...

mob/verb/ZoomIn()
set hidden=1
usr.client.view-=1


The problem is, when I use it, the camera tends to jump about - I've tried messing around with pixel offsets for the eye, to counteract that, (eg, if it's an even number, offset the eye by 16 pixels to keep the player in the centre,) but it's still jumpy.

Any ideas?

--Ray
You can try adding/subtracting to the offsets many times (ex. by 2 pixels every tick), and then edit the view and return the offsets to normal. It might still appear a little jumpy, but view doesn't take decimals as far as I know, so you can't get much better than that.
In response to Jeff8500
That was a pretty good idea, but in practice it doesn't work, it still makes the camera jump briefly to the side when zooming in/out. Hmm, I wonder if there's anything else that'll get it done.
Not possible. Changing the view size will cause the screen to get bigger by 32x32 pixel increments, no matter what.
You could change the view by 2 instead of 1.
In response to Kaiochao
Aye, I've been doing just that - the logic behind that being that an increment of two would leave the player dead-centre in the screen (assuming the view is an odd number.) The problem still comes up where the camera jiggles when resizing the screen. I'm not sure if it's just my OS/Setup, or if it's just one of those things BYOND does, though.
In response to R.J.T
It's BYOND. >_>
In response to R.J.T
I think what's happening is that BYOND is shrinking one axis first, adjusting your view to compensate, and the adjusting the other axis, and then compensating again. For a split second, your view is not square because of this, causing it to shift so your player is still centered. Since this happens on the client end, I doubt there's anything you can do about it, short of asking Lummox to see if there's anything that can be done (doubtful).
You can adjust the map control's icon-size parameter for relatively smooth zooming, though naturally for zooming out you will not actually see more, without modifying the view.
client //you can play with the parameters below
proc/zoom(delay=1,times=15,amount=3)
var/orig_iconsize = text2num(winget(src,"window.map","icon-size"))
for(var/iconsize=orig_iconsize || 32,times,times--)
iconsize += amount
if(iconsize <= 0) break
winset(src,"window.map","icon-size=[iconsize]")
sleep(delay)
winset(src,"window.map","icon-size=[orig_iconsize]")
verb
ZoomOut() src.zoom(3,amount = -3)
ZoomIn() src.zoom(3)

<small>edit: didn't account for iconsize dropping to 0 and below</small>