KingPolygon KingPolygon - 4 months ago 8
iOS Question

iOS: Animating Multiple UIBezierPaths (One After the Other)?

I have an array of

UIBezierPaths
. I loop through the array, create
CAShapeLayers
, and then animate them. The problem is they all animate at the same time. I'd like to animate them one after the other, but I'm having trouble doing so.

I've tried calculating the beginTime by doing the following, but all it does is animate the first line, but not the rest of the lines (they just appear without an animation).

pathAnimation.beginTime = n * lineDuration;

Answer
pathAnimation.beginTime = n * lineDuration;

Well, that's your problem. That time is in the deep dark past.

You want a time in the future. Start by getting the CACurrentMediaTime() and now add the delay amount to that.

Comments