Skip to content

Instantly share code, notes, and snippets.

@fhefh2015
Created May 24, 2016 03:09
Show Gist options
  • Save fhefh2015/19a92366a29610df0256588729c9ee87 to your computer and use it in GitHub Desktop.
Save fhefh2015/19a92366a29610df0256588729c9ee87 to your computer and use it in GitHub Desktop.
CAAnimateGroup组合动画
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
CABasicAnimation *baseAnimate1 = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
baseAnimate1.toValue = @(0.1);
baseAnimate1.duration = 0.5;
CABasicAnimation *baseAnimate2 = [CABasicAnimation animationWithKeyPath:@"position"];
baseAnimate2.toValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];
baseAnimate2.duration = 0.5;
CAAnimationGroup *animateGroup = [CAAnimationGroup animation];
animateGroup.animations = @[baseAnimate1, baseAnimate2];
animateGroup.removedOnCompletion = NO;
animateGroup.fillMode = kCAFillModeForwards;
[self.testView.layer addAnimation:animateGroup forKey:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment