//create a path
UIBezierPath *bezierPath = [[UIBezierPathalloc]init];
[bezierPath moveToPoint:CGPointMake(0,150)];
[bezierPath addCurveToPoint:CGPointMake(300,150)controlPoint1:CGPointMake(75,0)controlPoint2:CGPointMake(225,300)];
//draw the path using a CAShapeLayer
CAShapeLayer *pathLayer = [CAShapeLayerlayer];
pathLayer.path = bezierPath.CGPath;
pathLayer.fillColor = [UIColorclearColor].CGColor;
pathLayer.strokeColor = [UIColorredColor].CGColor;
pathLayer.lineWidth =3.0f;
[self.view.layeraddSublayer:pathLayer];
//add a colored layer
CALayer *colorLayer = [CALayerlayer];
colorLayer.frame =CGRectMake(0,0,64,64);
colorLayer.position =CGPointMake(0,150);
colorLayer.backgroundColor = [UIColorgreenColor].CGColor;
[self.view.layeraddSublayer:colorLayer];
//create the position animation
CAKeyframeAnimation *animation1 = [CAKeyframeAnimationanimation];
animation1.keyPath =@"position";
animation1.path = bezierPath.CGPath;
animation1.rotationMode =kCAAnimationRotateAuto;
//create the color animation
CABasicAnimation *animation2 = [CABasicAnimationanimation];
animation2.keyPath =@"backgroundColor";
animation2.toValue = (__bridgeid)[UIColorredColor].CGColor;
//create group animation
CAAnimationGroup *groupAnimation = [CAAnimationGroupanimation];
groupAnimation.animations =@[animation1, animation2];
groupAnimation.duration =4.0;
groupAnimation.removedOnCompletion =NO;
groupAnimation.fillMode =kCAFillModeForwards;
//add the animation to the color layer
[colorLayer addAnimation:groupAnimationforKey:nil];