0
我有一个应用程序,当按下按钮(图像)时会旋转两次。我想循环缩放按钮并摇动按钮。所以这三个动画将是:缩放,平移,旋转。我怎样才能随机循环?这是我目前拥有的按钮:通过按钮上的动画随机循环
- (IBAction)playAudioAction:(id)sender {
UIButton *btn=(UIButton *)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;
[btn.layer addAnimation:fullRotation forKey:@"360"];
[self playAudioOfType:btn.tag];
}