Although I'm not sure about the specifics of how Apple dealt with this effect, it seems to me that this is a great opportunity to use CoreAnimation and custom animation properties. This post contains some interesting information on this subject. I assume that in the "Blue Marble drop" animation, you are referring to the following sequence:
- Big light blue circle scales in frame
- The large light blue circle oscillates between two relatively large radii, as the location is calculated
- A large light blue mug scales to a small dark blue circle in a custom location.
Although this may simplify the process a bit, I think this is a good place to start, and more sophisticated / detailed functionality can be added with relative ease (i.e. a small dark circle pulsates as a larger circle converges on it )
First of all, we need a custom subclass of CALayer with a custom property for our outer large radius of blue circles:
and implementation:
Thanks to this infrastructure, we can now easily animate the radius of the outer circle. b / c CoreAnimation will take care of value interpolations as well as redraw calls. All we need to do is add animation to the layer. As a simple proof of concept, I chose a simple CAKeyframeAnimation for going through a three-stage animation:
The above is a pretty “hacky" proof of concept, as I'm not sure how you intend to use this effect. For example, if you want to oscillate a circle until the data is ready, the above will not make much sense, because it will always oscillate twice.
Some closing notes:
- Again, I am not sure of your intentions regarding this effect. If for example, you add it to
MKMapView , this may require some settings for integration with MapKit. - A related article assumes that the above method requires a version of CoreAnimation in iOS 3.0+ and OS X 10.6 +
- Speaking of a related post (as I often did), many thanks and thanks to Ole Begemann, who wrote it and did a great job explaining user properties in CoreAnimation.
EDIT: Also, for performance reasons, you probably want to make sure that the level does not exceed as much as necessary. That is, after you have done the animation of a larger size, you may need to scale the size down so that you use / draw as much space as necessary. A good way to do this would be to simply find a way to animate bounds (as opposed to circleRadius ) and perform this animation based on size interpolation, but I had some problems implementing it (maybe someone could add some insight on this) .
Hope this helps, Sam
source share