Only supporting a single keyframe at a given time is an easy source of error
sibljon opened this issue · 1 comments
sibljon commented
Please correct me if I'm wrong, but it seems that only one IFTTTAnimationKeyFrame
can be added to an animation for a given "time". I believe this to be an easy source of confusion. For example, the following doesn't change the view
's alpha at all:
[self.animation addKeyFrames:@[
[IFTTTAnimationKeyFrame keyFrameWithTime:time0 andFrame:offscreenFrame],
[IFTTTAnimationKeyFrame keyFrameWithTime:time0 andAlpha:0],
[IFTTTAnimationKeyFrame keyFrameWithTime:time1 andFrame:view.frame],
[IFTTTAnimationKeyFrame keyFrameWithTime:time1 andAlpha:1],
[IFTTTAnimationKeyFrame keyFrameWithTime:time2 andAlpha:0],
[IFTTTAnimationKeyFrame keyFrameWithTime:time2 andFrame:offscreenFrame],
]];
In fact, the above fails silently, only changing the view's frame. but the following does change the alpha:
[self.animation addKeyFrames:@[
[IFTTTAnimationKeyFrame keyFrameWithTime:time0 andFrame:offscreenFrame],
[IFTTTAnimationKeyFrame keyFrameWithTime:time0 + 1 andAlpha:0],
[IFTTTAnimationKeyFrame keyFrameWithTime:time1 - 1 andFrame:view.frame],
[IFTTTAnimationKeyFrame keyFrameWithTime:time1 andAlpha:1],
[IFTTTAnimationKeyFrame keyFrameWithTime:time2 - 1 andAlpha:0],
[IFTTTAnimationKeyFrame keyFrameWithTime:time2 andFrame:offscreenFrame],
]];
sibljon commented
Heh, ok, so looks like I had a gap in my understanding. The clear solution is to create a IFTTTFrameAnimation
and a IFTTTAngleAnimation
instance (rather than trying to combine them as I did above).