animate/change images based on the accelerometer?
I want to know if its possible to change images with the accelerometer based on math.
Its a bit hard to explain but I will give it a shot.
I have an animation of 15 images. 7 images rotate the plane to the left, 7 images rotate the plane to the right, and 1 image is when the plane is straight. if you tilt the device to the left, it has to animate based on the motion of the device. when you tilt the device back till its straight, it has to animate back. If you tilt the device a bit to the left it only needs to animate untill image 4 for example. same thing goes for tilting to the right.
I can make this animation based on 15 rules, but I really want to have a clean code, just in case I need to make some changes.
I hope someone can help me out with this! Thanks.