I'm using iCarousel plugin with custom transformations and I try to make a specific fade effect. I want all items before current item faded but current item and all after not faded. Is there a way to do this with fade options ? I tried but didn't succeed. So I tried to make animations on views of the carousel. This is what i got here :
- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel
{
UIView *viewToFadeOut = [carousel itemViewAtIndex:self.carousel.currentItemIndex-1];
[UIView animateWithDuration:0.5 delay:0.0 options:0 animations:^{
viewToFadeOut.alpha = 0.6f;
} completion:^(BOOL finished) {
}];
UIView *viewToFadeIn = [carousel itemViewAtIndex:self.carousel.currentItemIndex];
[UIView animateWithDuration:0.5 delay:0.0 options:0 animations:^{
viewToFadeIn.alpha = 1.0f;
} completion:^(BOOL finished) {
}];
}
But it doesn't work exactly as I want because the fadeIn animation starts once the current item changed and so animation starts too late.
Maybe is there a way to implement a method like
- (void)carouselCurrentItemIndexWillChange:(iCarousel *)carousel;
and start the fadeOut animation with a delay ?
If I've understood correctly, you simply need to add this to your delegate: