I'm using a UIKit dynamics for animating a UIView. As the UIView
is dragged (responding to physics and whatnot), the background view (it's superview) needs to fade out and some UILabel
needs to fade in. So far, I've gotten away with doing this by adding a block to the appropriate UIDynamicBehavior
and manually go about decreasing the superview's alpha and increasing the UILabel's
alpha. This works fine as long as I want a linear crossfade, that is: superview(1 - a) + label(a).
But actually, my animation needs to be a bit more involved. Something along the lines of:
- The superview starts fading out, say up to .2 alpha
- At this point the label starts fading in at a greater pace (different timing function if you will).
- At the end of the animation, the superview is at alpha = 0 and the label at alpha = 1.
Sure, I could just compute this into a formula and manually update the alpha values according to that. But I was wondering if there is a way I could create a CA animation group or CATransaction with a few animations, apply this to the appropriate layers and then step thru the frames in the action block of the dynamic behavior.
For instance, the CAMediaTiming
protocol has timeOffset
which can be used to start the animation offset in time. I'm thinking something similar but that would essentially keep the animation "paused" at all times and I could just tell it to jump to (interpolate) a specific point in time. I'm not sure, however, if there is any such property (like timeOffset
) or way to do it.