How to generate CGPath values ββfrom logo
There is an interesting animation at the bottom of this page. It's basically animation CAShapeLayer
using UIPanGestureRecognizer
.
(source: ronnqvi.st )
I wanted to see how it was done, so I went to the github page and found this one . Below is a small piece of code.
- (CGPathRef)loadPath
{
CGMutablePathRef path = CGPathCreateMutable();
// load
CGPathMoveToPoint(path, NULL, 7.50878897, 25.2871097);
CGPathAddCurveToPoint(path, NULL, 7.50878897, 25.2871097, 21.7333976, 26.7812495, 29.6894527, 20.225586);
CGPathAddCurveToPoint(path, NULL, 37.6455074, 13.6699219, 39.367189, 3.85742195, 31.9697262, 1.25976564);
CGPathAddCurveToPoint(path, NULL, 24.5722639, -1.33789083, 21.99707, 10.9072268, 21.99707, 22.2255862);
CGPathAddCurveToPoint(path, NULL, 21.9970685, 33.5439456, 15.9355469, 45.8212894, 8.99707031, 47.7294922);
...
How can I generate these values CGPath
? Any example would be helpful.
+3
source to share