Id have an app that does one thing if you shake it one way, and another if you shake it the other.
atm my code is.
if (acceleration.x > 1.5) {
//arm to the right when facing you
float duration = ([imageArray count]*0.04);
//HUMAN EYE KEEPS IMAGES IN EYE For 40 MILLISECONDS//
//NSLog(@"duration:%f", duration);
[theFlash setAnimationImages:imageArray];
[theFlash setAnimationRepeatCount:1];
theFlash.animationDuration = duration;
[theFlash startAnimating];
NSLog(@"images flashed forward");
}
if (acceleration.x < -1)
{
//arm to the left when facing you
float duration = ([imageArrayReversed count]*0.04);
//HUMAN EYE KEEPS IMAGES IN EYE For 40 MILLISECONDS//
NSLog(@"duration:%f", duration);
[theFlash setAnimationImages:imageArrayReversed];
[theFlash setAnimationRepeatCount:1];
theFlash.animationDuration = duration;
[theFlash startAnimating];
NSLog(@"images flashed backward");
}
the 1 and -1 values are working on it not being too sensitive.
however, this code is not giving me the results desired. Id like the images to flash (see the code) as soon as the person starts moving the device the other way.
Any way to do this?