#746 – Specifying Inertial Deceleration
January 31, 2013 3 Comments
In WPF, you can use inertia so that objects will continue moving on the screen after you lift your finger off the screen.
Calculation of inertial behavior requires both an initial velocity and a deceleration. WPF knows the initial velocity of an object, based on how fast you are moving it on the screen. The deceleration value is something that you specify.
Initial velocity values are typically in the range of around 0-4 DIPs/ms (DIPs per millisecond), or 0-42 in/sec.
Deceleration is expressed in DIPs/ms^2 (DIPs per millisecond squared). If we want to decelerate to 0 within about 1/2 sec, we can use values in the range of 0-0.008 DIPs/ms^2. (4 / 500). This is equivalent to 83 ft/sec^2.
If you start with a deceleration value in in/sec^2, you can convert to DIPs/ms^2 using the formula:
x’ = x * 96 / (1000 * 1000)
You can experiment with different deceleration values to get the exact deceleration behavior that you want in your application.