I have an app that currently rotates a button (image) twice when pressed. I'm wanting to cycle through scaling the button and also shaking the button. So the three animations would be: Scale, translate, rotate. How can I cycle through these randomly? Here's what I currently have for the button:
- (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];
}