1.
makeImageCard = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"makeCard_Image.png"]];
makeImageCard.frame = CGRectMake(([[UIScreen mainScreen] bounds].size.width-543/1.9)/2, self.navigationController.navigationBar.frame.size.height+[[UIApplication sharedApplication] statusBarFrame].size.height, 543/1.9, 998/2.36);
makeImageCard.userInteractionEnabled = YES;
[self.view addSubview:makeImageCard];
CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
animation.duration = 0.5;
NSMutableArray *values = [NSMutableArray array];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1, 1.1, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
animation.values = values;
[makeImageCard.layer addAnimation:animation forKey:nil];
2.
#pragma mark - Showing popup
- (void)showInView:(UIView *)parentView
centerAtPoint:(CGPoint)pos
duration:(CGFloat)waitDuration
completion:(void (^)(void))block
{
self.center = pos;
self.animationCompletion = block;
CABasicAnimation *forwardAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
forwardAnimation.duration = self.forwardAnimationDuration;
forwardAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.5f :1.7f :0.6f :0.85f];
forwardAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
forwardAnimation.toValue = [NSNumber numberWithFloat:1.0f];
CABasicAnimation *reverseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
reverseAnimation.duration = self.backwardAnimationDuration;
reverseAnimation.beginTime = forwardAnimation.duration + waitDuration;
reverseAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.4f :0.15f :0.5f :-0.7f];
reverseAnimation.fromValue = [NSNumber numberWithFloat:1.0f];
reverseAnimation.toValue = [NSNumber numberWithFloat:0.0f];
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
animationGroup.animations = [NSArray arrayWithObjects:forwardAnimation, reverseAnimation, nil];
animationGroup.delegate = self;
animationGroup.duration = forwardAnimation.duration + reverseAnimation.duration + waitDuration;
animationGroup.removedOnCompletion = NO;
animationGroup.fillMode = kCAFillModeForwards;
[parentView addSubview:self];
[UIView animateWithDuration:animationGroup.duration
delay:0.0
options:0
animations:^{
[self.layer addAnimation:animationGroup
forKey:@"kLPAnimationKeyPopup"];
}
completion:^(BOOL finished) {
}];
}
3
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.05, 1.05, 1)];;
animation.duration = 0.07;
animation.autoreverses = YES;
animation.repeatCount = 1;
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeForwards;
[deletedAlert.layer addAnimation:animation forKey:nil];
deletedAlert.transform = CGAffineTransformMakeScale(1.0, 1.0);