Reputation: 3847
When I use CAShapeLayer
and create a rectangle shape then the path starts at rectangle's origin (top-left corner) and draws clockwise. Now if I want to draw only part of the shape then I'm using strokeStart
and strokeEnd
properties. The problem comes when I want to draw a part consisting the path's end points. In this case the path is closed and it starts and ends on rectangle's top-left corner. When I'm setting strokeStart=0.8
and strokeEnd=0.2
I'm hoping it to draw the last section of the path and a bit from the beginning of the path. However, this is not working. Are there any ideas or tricks how to do this?
Update:
Adding an image to clarify what I mean above. I want an animation which draws a small amount of rectangle and that drawn part circles over the rectangle:
Upvotes: 5
Views: 732
Reputation: 131418
The short answer is that I don't think you can do that, at least not with a single path that will draw any of the segments in your examples. I'm pretty sure that strokeStart must be less than strokeEnd.
If you want to draw your last segment you'd need to create a custom rectangle path that started at the lower left corner and wrapped around.
Upvotes: 2