Skip to content

Instantly share code, notes, and snippets.

@ariok
Created December 30, 2013 21:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariok/8188785 to your computer and use it in GitHub Desktop.
Save ariok/8188785 to your computer and use it in GitHub Desktop.
Group of animations in CA
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"];
anim.fromValue = @(0.0);
anim.toValue = @(1.0);
CGPoint point = [self createPosition]
CABasicAnimation *anim2 = [CABasicAnimation animationWithKeyPath:@"position"];
anim2.fromValue = [NSValue valueWithCGPoint:label.position];
anim2.toValue = [NSValue valueWithCGPoint:point];
CAAnimationGroup *group = [CAAnimationGroup animation];
group.duration = 0.3;
group.autoreverses = NO;
group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
group.removedOnCompletion = NO;
group.fillMode = kCAFillModeForwards;
group.animations = @[anim, anim2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment