Runs POP Animations sequentially, one after another.
Edit Podfile and add JPPopSequenceAnimation:
pod 'JPPopSequenceAnimation'Clone the repository:
$ git clone https://github.com/Juanpe/JPPopSequenceAnimation.gitDrag and drop JPPopSequenceAnimationClasses folder into your project. Add #import "JPPopSequenceAnimation.h" to all view controllers that need to use it.
- iOS 7.0 or higher
- ARC
You can easily set the number of repetitions of sequence and set start index:
@property (nonatomic) NSInteger beginIndex;
@property (nonatomic) NSInteger numRepeats;
sequenceAnimation.numRepeats = 2;
sequenceAnimation.numRepeats = JPPopSequenceRepeatForever; // Forever
sequenceAnimation.beginIndex = 1;If you want to get animations callbacks, you must implement protocol named ```JPPopSequenceAnimationDelegate```.
@optional
- (void) sequenceDidStart:(JPPopSequenceAnimation *) sequence;
- (void) sequenceDidResume:(JPPopSequenceAnimation *) sequence;
- (void) sequenceDidStop:(JPPopSequenceAnimation *) sequence;
- (void) sequenceDidPause:(JPPopSequenceAnimation *) sequence;
- (void) sequenceDidNextAnimation:(JPPopSequenceAnimation *) sequence
atIndex:(NSInteger) index;
- (void) sequence:(JPPopSequenceAnimation *) sequence
animationDidStart:(POPAnimation *) anim
atIndex:(NSInteger) index;
- (void) sequence:(JPPopSequenceAnimation *) sequence
animationDidStop:(POPAnimation *) anim
atIndex:(NSInteger) index
finished:(BOOL) finished;
POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha];
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.fromValue = @(1.0);
anim.toValue = @(0.0);
anim.name = @"fadeOut";
POPBasicAnimation *anim1 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha];
anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim1.fromValue = @(0.0);
anim1.toValue = @(1.0);
anim.name = @"fadeIn";
JPPopSequenceAnimation * sequenceAnimation = [[JPPopSequenceAnimation alloc] initWithAnimations:@[anim, anim1]];
sequenceAnimation.delegate = self;
[self.squareView addSequenceAnimation:sequenceAnimation
forKey:@"sequence_1"];