IFTTT/JazzHands

Broken hide animation!!!

revolter opened this issue · 1 comments

Previously, I had this code:

- (void)setView:(UIView *)view hiddenAtEndOfAnimation:(BOOL)hidden atPage:(Page)page {

	IFTTTHideAnimation *hideAnimation = [[IFTTTHideAnimation alloc] initWithView:view];

	[hideAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:page.left andHidden:!hidden]];
	[hideAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:page.right - 1 andHidden:!hidden]];

	[hideAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:page.right andHidden:hidden]];

	[self.contentAnimator addAnimation:hideAnimation];
}

but with the latest version, this is impossible, as there is no simple init that only sets the view. Highly dissapointed.

I found out a very hacky way for this:

- (void)setView:(UIView *)view hiddenAtEndOfAnimation:(BOOL)hidden atPage:(Page)page {

	IFTTTHideAnimation *hideAnimation = [[IFTTTHideAnimation alloc] init];

	[hideAnimation setValue:view forKey:@"_view"];

	[hideAnimation addKeyframeForTime:page.left value:[NSNumber numberWithBool:!hidden]];
	[hideAnimation addKeyframeForTime:page.right - 1 value:[NSNumber numberWithBool:!hidden]];

	[hideAnimation addKeyframeForTime:page.right value:[NSNumber numberWithBool:hidden]];

	[self.contentAnimator addAnimation:hideAnimation];
}

which it works but it's ugly. I don't understand why was it crashing with New value must have the same interpolatable type as existing keyframe values. though, when I was using @(hidden).