ReactiveCocoaLayout
ReactiveCocoaLayout copied to clipboard
Support key frame animations
It'd be nice if there were first-class support for key frame animations. I'm not totally sure what that would look like. Maybe an operator like -sequenceNext: but that completes when the animation completes? It'd be kinda dumb-guy keyframing but it'd work.
Can you do this with -doAnimationCompleted:?
Not really. There's no good way to run a CAKeyframeAnimation manually with the animator proxy. For the dumb-guy version, the block would need to return a new signal to use to set the keypath.
In other words, something like:
RAC(self.view.rcl_frame) = [[[RACSignal return:frame1] animateWithDuration:0.3] animateNext:^{
return [[RACSignal return:frame2] animateWithDuration:0.6];
}];
Where -animateNext: only continues to its block after the other animation has completed.
Maybe this should involve a tuple representation:
RACSignal *frames = [RACSignal return:RACTuplePack(frame1, frame2)];
RAC(self.view.rcl_frame) = [frames animateKeyframesWithDurations:@[ @0.3, @0.6 ]];
The API is a bit more unwieldy (at least in terms of composability), but it's translatable to a single CAKeyframeAnimation, so there are no timing issues with paused or delayed run loops.
Ehh, that API's fairly gross but I don't have any better suggestions :\