Re: Getting Started with Animations


 


On Jul 14, 2017, at 5:39 AM, Dave <dave@...> wrote:

I want the View to fly across the screen from the left player area to a position in the board view. In order to do this, do I create a new CALayer or do I use the CALayer of the View I’m moving. 

It’s been years since I did much with CoreAnimation, but IIRC a layer is clipped to its parent layer, so if you want this to happen you need to make the view temporarily be a direct subview of your RootView. I.e. remove it from its superview, add it to the RootView (doing some coordinate transformation so its at the same place on the screen), run the animation, and when the animation finishes do the same in reverse but ending up in the BoardView.

You may want to consider not using a view hierarchy, at least for the views that need to move around a lot.

—Jens

Join cocoa@apple-dev.groups.io to automatically receive all group messages.