0

If I have an object performing this CAKeyframe Animation path (it is just an oval shape in the upper region of an iphone..

 UIBezierPath *trackPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(20, 100, 280, 150)];

Now imagine that at anytime during this paths travels I want to create a smooth path from its current position at a point in time and some point at the bottom of the screen.

By the way I am assuming that once I have a path I can stop the current CAKeyframeAnimation and add this path to a new CAKeyframe animation, but maybe if this is incorrect you can give me pointers here as well please.

darbid
  • 2,545
  • 23
  • 55

1 Answers1

1

So I said to myself "Self.....it looks like you are going to have to answer this one yourself as nobody even wants to edit it or say that it is a duplicate......"

So I was hoping for some easier or ready made way to do this. From what I have found there is no easy way. It seems the steps are going to be;

  1. get the current position of the animated layer
  2. calculate yourself with all your own code a nice smooth curve
  3. add this path to an animation and animate it.

As for the calculation of a Bezier Curve I am still looking to find some class or code where points can be plugged into it and the two control points are produced for the UIBezier class to produce a curve.

In my case I am going to only animate "out" of my above questioned shape a determined points and thus have ready made smooth curves which I have prepared.

Animating a smooth exit from an oval at any point is very complicated and In my case just not worth it. So I have not done that.

darbid
  • 2,545
  • 23
  • 55
  • Sorry about that. Anyway, part of the answer you'll find here http://stackoverflow.com/questions/2576113/how-to-animate-the-drawing-of-a-cgpath, especially the answer which references Ole Begemann's project http://oleb.net/blog/2010/12/animating-drawing-of-cgpath-with-cashapelayer/ – Elise van Looij Mar 16 '14 at 16:54