#754 – Implementing Inertia for Expansion during Touch Manipulation
February 12, 2013 Leave a comment
You can set the TranslationBehavior.DesiredDeceleration in the ManipulationInertiaStarting event to allow inertia when translating using touch manipulation. This allows an element to continue moving a little bit after you lift your finger off the element while doing translation manipulation.
You can also enable inertia for expansion (i.e. scaling) during touch manipulation. An element will then continue expanding or contracting when you lift your fingers from the screen while doing expansion using touch. You do this by setting the ExpansionBehavior.DesiredDeceleration property.
private void Image_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e) { // 10 in/sec^2 deceleration e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0); // 960 DIPS/sec^2 deceleration Console.WriteLine(string.Format("Init Expansion Velocity = {0}", e.ExpansionBehavior.InitialVelocity)); e.ExpansionBehavior.DesiredDeceleration = 960.0 / (1000.0 * 1000.0); }
Doing this is perhaps a little less useful than specifying inertia during translation. Inertia as part of expansion is a little less intuitive.