I’m trying to animate a path and with the changing of it’s points, as shown in the keyframes below. So, the top two points move down to the bottom and the middle point moves to the top, essentially flipping it’s direction.
Here’s the code I’m using to create the path:
CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, nil, 1.0f, 8.0f); CGPathAddLineToPoint(path, nil, 7.0f, 1.5f); CGPathAddLineToPoint(path, nil, 13.0f, 8.0f); shapeLayer = [[CAShapeLayer alloc] init]; shapeLayer.path = path; shapeLayer.strokeColor = pathColor.CGColor; shapeLayer.fillColor = [NSColor clearColor].CGColor; shapeLayer.lineWidth = 2.0f; [self.layer addSublayer: shapeLayer];
However, I’ve also got little idea of how to actually animate the points. All the information about animating paths online is simply changing the path start, not the actual point.
Is there a way – or a different approach – to do this? Thanks in advance.