에서 힌트를 누르면 정답 숫자 들이 흔들 흔들
마치 앱을 삭제 할때 롱터치 하고 나면 아이콘이 흔들 흔들 거리는 효과이다.
CGAffineTransform leftWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5.0));
CGAffineTransform rightWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5.0));
btn.transform = leftWobble;
[UIView beginAnimations:@"wobble" context:btn];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:10];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(wobbleEnded:finished:context:)];
btn.transform = rightWobble;
[UIView commitAnimations];
- (void) wobbleEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
if ([finished boolValue]) {
UIView* item = (UIView *)context;
item.transform = CGAffineTransformIdentity;
}
}
btn (UIButton) 객체를 leftWooble, rightWooble로 transform 하면서 흔들 흔들
10회 하도록 하는 에니메이션이다.
댓글 없음:
댓글 쓰기