ios隐性动画--- 加贝塞尔曲线运动
2016-11-23 本文已影响217人
seventhboy
------------------------------------凌乱的分割线----------------------------------------
加贝塞尔曲线运动
CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
positionAnimation.calculationMode = kCAAnimationPaced;
positionAnimation.fillMode = kCAFillModeForwards;
positionAnimation.removedOnCompletion = NO;
positionAnimation.repeatCount = 0;
CGMutablePathRef curvedPath = CGPathCreateMutable();
UIBezierPath *cutePath = [UIBezierPath bezierPath];
[cutePath moveToPoint:fpoint];
[cutePath addCurveToPoint:tpoint controlPoint1:point1 controlPoint2:point2]; //贝塞尔曲线
CGPathAddPath(curvedPath, 0, cutePath.CGPath);
positionAnimation.path = curvedPath;
CGPathRelease(curvedPath);