+(HFAnimation*)rarEffect:(UIView *)target
{
CGAffineTransform swingTransform = CGAffineTransformIdentity;
swingTransform = CGAffineTransformRotate(swingTransform, DegreesToRadians(20));
[UIView beginAnimations:@"swing" context:target];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatCount:4];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView animateWithDuration:0.8 animations:^{
target.transform = swingTransform;
} completion:^(BOOL finished){
CGAffineTransform swingTransform = CGAffineTransformIdentity;
swingTransform = CGAffineTransformRotate(swingTransform, DegreesToRadians(0));
[UIView beginAnimations:@"swing" context:target];
[UIView setAnimationRepeatCount:4];
// [UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationDuration:0.8];
target.transform = swingTransform;
[UIView commitAnimations];
}];
[UIView commitAnimations];
return nil;
}
7:33
#define DegreesToRadians(x) (M_PI * x / 180.0)
7:33
调用for (GoldView *tmp in viewGoldCollection)
{
[HFAnimation rarEffect:tmp];
}