Search code examples
c#xamlwindows-phone-7windows-phone-8accelerometer

Changing position of background image based on accelerometer readings WP8


I need to get the accelerometer readings (only X) for now, and move the background image left and right based on the values.Im able to retreive the values and call a method to update UI.

 imgtobemoved.TranslateX += (acceleration.X)*64 

This works fine but , It is not smooth ,I want the transition to be smooth.How do I add an easing function to the above code.Should I use a story board animation, If so is there any way to bind the accelerometer reading to XAML.Can anyone help me with the code?

And my second question is I have set CacheMode="BitmapCache" on the image, Is there any other way to enhance the performance of this?


Solution

  • There is a good explenation about using these acceleration values to smooth the transition on the Compiled Experience website here... I think it might help also in your case!