I am trying to make a custom animation in the opacity of the view as follows:
- Delay for 5 seconds; (The view will be opaque for 5 seconds).
- Animation from opacity value from 1 to 0;
- Delay for 5 seconds; (The view will remain transparent for 5 seconds).
- Animation from opacity value from 0 to 1;
I want to repeat steps 1 to 4 endlessly: 1, 2, 3, 4, 1, 2, 3, 4, .....
Here is what I tried:
[UIView animateWithDuration:1 delay:5 options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat|UIViewAnimationOptionCurveEaseInOut animations:^{ self.imageView.layer.opacity = 0; } completion:nil ];
But the delay appeared only once in the beginning that I ended up:
1, 2, 4, 2, 4, 2, 4, .....
source share