0

アプリでこの「ホイールを回す」エフェクトを作成しようとしていますが、ボトルを回転させることができますが、同じ位置で止まります。ランダムに停止させるにはどうすればよいですか?皆さん、ありがとうございました

ここにコード:

- (IBAction)spin:(id)sender {
    CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath: @"transform.rotation"];
    fullRotation.fromValue = [NSNumber numberWithFloat:0];
    fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
    fullRotation.duration = 0.5;
    fullRotation.repeatCount = 2;
    [button.layer addAnimation:fullRotation forKey:@"360"]; 
}
4

1 に答える 1