smooth zooming

Jun 24, 2009 at 3:41 AM


I want to do a smooth zooming in/out(easing out) using the right mouse button drag....  how do i do that?



Jun 24, 2009 at 4:09 AM

Zoom = VEMap.Altitude

In your event handler that filters for the right mouse button, determine the delta between the current and previous mouse position (will be positive or negative depending upon direction), multiply that by some constant, and add the value to the altitude.  The constant will determine how quickly it zooms.  For example, if you want moving the mouse 1 pixel to change the altitude by 50 feet, your constant should be 50.  

You could also have a more complicated formula so that fast dragging moves quicker than slow dragging.  For that I'd suggest starting with something like altitude += constant * pixels^exponent and play with the exponent, starting with a value slightly above 1, like 1.05.


Jun 25, 2009 at 9:49 AM

Hi, I'm trying to use the Animate library from to do the ease out... am i on the correct path?

i put this line on the mouseMove event... doesn't seems to work properly... i'm trying to get smooth zooming like the one in Nasa World Wind Java....

Animator.AnimatePenner(, VEMap.AltitudeProperty, PennerDoubleAnimation.Equations.QuartEaseOut, newAltitude, 500, finishZoom);

from what i understand, while the above line in animating with the duration of 500ms, and another mouseMove event is invoke, i need to stop it and recalculate an reanimate right?

I actually don't really know how smooth animation work in WPF dynamically... please advise if you can.. thanks.

Jun 25, 2009 at 11:46 PM

I've never used that library but InfoStrat.VE already has some animation helper functions.  See this thread:

The easing is hard coded but you may find that code to be a good starting point if you need to do more.  They are fire-and-forget calls, so just call AnimateUtility.AnimateDouble(...).

I'm not sure what the behavior will be if you call it a whole bunch of times right after another as I haven't used the AnimateUtility in that kind of scenario.