弹出:
CAKeyframeAnimation *animation = [CAKeyframeAnimationanimationWithKeyPath:@"transform.scale"];
animation.values =@[@(0.01),@(1.2),@(0.9),@(1)];
animation.keyTimes = @[@(0),@(0.4),@(0.6),@(1)];
animation.timingFunctions =@[[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut]];
animation.duration = 0.5;
animation.delegate = self;
[popImageView1.layer addAnimation:animationforKey:@"bouce"];
点击消失:
CAKeyframeAnimation *animation = [CAKeyframeAnimationanimationWithKeyPath:@"transform.scale"];
animation.values = @[@(1),@(1.2),@(0.01)];
animation.keyTimes = @[@(0),@(0.4),@(1)];
animation.timingFunctions =@[[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut], [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut]];
animation.duration = 0.35;
animation.delegate = self;
[button.superview.layeraddAnimation:animationforKey:@"bounce"];
button.superview.transform =CGAffineTransformMakeScale(0.001,0.001);
若要区分动画,则可以这样 (已测 可以达到效果chenyong) 0122 (这样貌似也有点问题,偶尔会崩溃好像,可以设置一个全局int值 ,来区分动画)
[animation setValue:@"throbUp" forKey:@"animationID"];
转载自:/questions/1255086/how-to-identify-caanimation-within-the-animationdidstop-delegate
如果觉得《电池管家 动画效果》对你有帮助,请点赞、收藏,并留下你的观点哦!