- (void)translateAnimation { [UIView animateWithDuration:1 delay:1 options:UIViewAnimationOptionCurveEaseInOut animations:^{ _imageView.center = CGPointMake(270, 410); } completion:^(BOOL finished) { NSLog(@"done"); }]; }
- (void)transformAnimation { [UIView animateWithDuration:3 delay:1 options:UIViewAnimationOptionCurveEaseIn animations:^{ _imageView.center = CGPointMake(270, 410); _imageView.transform = CGAffineTransformRotate(CGAffineTransformScale(_imageView.transform, 0.6, 0.6), M_PI); _imageView.alpha = 0.0; } completion:^(BOOL finished) { NSLog(@"done"); }]; }
- (void)transformAnimation { [UIView animateWithDuration:3 delay:1 options:UIViewAnimationOptionCurveEaseIn animations:^{ _imageView.center = CGPointMake(270, 410); _imageView.transform = CGAffineTransformRotate(CGAffineTransformScale(_imageView.transform, 0.6, 0.6), M_PI); _imageView.alpha = 0.0; } completion:^(BOOL finished) { NSLog(@"done"); [UIView animateWithDuration:3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{ _imageView.center = CGPointMake(50, 50); _imageView.transform = CGAffineTransformIdentity; _imageView.alpha = 1.0; } completion:nil]; }]; }
@interface ViewController () { NSTimer *_timer; NSInteger _step; }
- (void)timerAnimation { _timer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(animateWithTimer) userInfo:nil repeats:YES]; } - (void)animateWithTimer { if (_step == 0) { [_timer invalidate]; [_imageView removeFromSuperview]; } _imageView.transform = CGAffineTransformRotate(CGAffineTransformScale(_imageView.transform, 0.98, 0.98), ((10 * M_PI) / 180.0)); _imageView.alpha *= 0.98; _step--; }