CAShapeLayer curved path animation
CAShapeLayer curved path animation
- Subject: CAShapeLayer curved path animation
- From: Gideon King <email@hidden>
- Date: Sun, 7 Nov 2010 09:41:05 +1000
I'm using a CAShapeLayer, and the animation of the shape of the curved path I am using is doing really strange things (It seems to work fine on straight lines). I have tried:
CGPathMoveToPoint(tempPath, NULL, startPoint.x, startPoint.y);
CGPathAddQuadCurveToPoint(tempPath, NULL, ctrl1.x, ctrl1.y, midPoint.x, midPoint.y);
CGPathAddQuadCurveToPoint(tempPath, NULL, ctrl2.x, ctrl2.y, endPoint.x, endPoint.y);
and:
CGPathMoveToPoint(tempPath, NULL, startPoint.x, startPoint.y);
CGPathAddCurveToPoint(tempPath, NULL, ctrl1.x, ctrl1.y, ctrl1.x, ctrl1.y, midPoint.x, midPoint.y);
CGPathAddCurveToPoint(tempPath, NULL, ctrl2.x, ctrl2.y, ctrl2.x, ctrl2.y, endPoint.x, endPoint.y);
In my tests, startPoint remains constant, endPoint moves around, midPoint is half way between the start and end points. The control points are the same y position as the start/end and offset a constant amount in the x direction - i.e. in this scenario, startPoint and ctrl1 are fixed, midPoint moves half the amount of the change in the end point, and ctrl2 moves the amount of the movement of the end point.
The symptoms I am seeing are that sometimes during the animation the start point is being moved on the x axis, so that it reverses the curvature of the path or moves the end of the path away from the end making it a wider curve. I have other curves I am drawing which have some issues during animation, but this is by far the worst.
If I could draw the curve myself during animation, I could get it to do what I want, but I don't see any way of doing that.
I am therefore wondering if there is any way I could construct the curve differently so that it animates nicely?
Thanks
Gideon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden