私のアプリでは、加速度計の動きに合わせてボールを動かしていますが、ボールがスムーズに動きませんでした。ビュー上でボールをスムーズに動かす必要があります。
グーグルで検索して以下のステートメントを使用しましたが、滑らかなオブジェクトが得られませんでした
delta.x = 0.01 * delta.x + (1.0 - 0.01) * acceleration.x;
delta.y = 0.01 * delta.y + (1.0 - 0.01) * acceleration.y;
私のアプリでは、加速度計の動きに合わせてボールを動かしていますが、ボールがスムーズに動きませんでした。ビュー上でボールをスムーズに動かす必要があります。
グーグルで検索して以下のステートメントを使用しましたが、滑らかなオブジェクトが得られませんでした
delta.x = 0.01 * delta.x + (1.0 - 0.01) * acceleration.x;
delta.y = 0.01 * delta.y + (1.0 - 0.01) * acceleration.y;
試す :
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
point = CGPointMake(34*acceleration.x, -20*acceleration.y);
image.center = CGPointMake(image.center.x+point.x,image.center.y);
}
使用する
[UIView beginAniations:@"AnimaionName" context:nil];
[UIView setAnimationDuration: 2.0f];
imageView.frame = CGRectMake(,,,);
[UIView commitAnimation];
これでスムーズな動きになります