Skip to content

Instantly share code, notes, and snippets.

@cyndibaby905
Created December 4, 2013 02:34
Show Gist options
  • Save cyndibaby905/7781375 to your computer and use it in GitHub Desktop.
Save cyndibaby905/7781375 to your computer and use it in GitHub Desktop.
Animation issues
CABasicAnimation *positionAnimation;
positionAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
positionAnimation.fromValue = [NSValue valueWithCGPoint:fromPosition];
positionAnimation.toValue = [NSValue valueWithCGPoint:toPosition];
CABasicAnimation *alphaAnimation;
alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
alphaAnimation.fromValue = [NSNumber numberWithFloat:fromAlpha];
alphaAnimation.toValue = [NSNumber numberWithFloat:toAlpha];
CABasicAnimation* scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.fromValue = [NSNumber numberWithFloat:fromScale];
scaleAnimation.toValue = [NSNumber numberWithFloat:toScale];
CAAnimationGroup *group = [CAAnimationGroup animation];
[group setAnimations:[NSArray arrayWithObjects: alphaAnimation, positionAnimation, scaleAnimation, nil]];
group.duration = duration;
group.removedOnCompletion = YES;
group.beginTime = CACurrentMediaTime() + delayInSeconds;
[view.layer addAnimation:group forKey:@"dropAnimation"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment