Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. -(void)fadeOutIn:(UIView *)view duration:(NSTimeInterval)duration
  2. {
  3. static CGFloat alpha = 1.0;
  4. [UIView animateWithDuration:duration
  5. delay:0.0
  6. options: UIViewAnimationOptionRepeat| UIViewAnimationOptionCurveEaseInOut
  7. animations:^{
  8. alpha = abs((int)(alpha - 1.0));
  9. view.alpha = alpha;
  10. }
  11. completion:^(BOOL finished){
  12. }];
  13. }
  14.  
  15. -(void)fadeOutIn:(UIView *)view duration:(NSTimeInterval)duration
  16. {
  17. [UIView animateWithDuration:duration
  18. delay:0.0
  19. options: UIViewAnimationOptionRepeat| UIViewAnimationOptionCurveEaseInOut
  20. animations:^{
  21. view.alpha = 0.0;
  22. }
  23. completion:^(BOOL finished){
  24.  
  25. [UIView animateWithDuration:duration
  26. delay:0.0
  27. options: UIViewAnimationOptionRepeat|UIViewAnimationOptionCurveEaseInOut
  28. animations:^{
  29. view.alpha = 1.0;
  30. }
  31. completion:^(BOOL finished){
  32.  
  33. }];
  34. }];
  35. }
  36.  
  37. [UIView animateKeyframesWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse|UIViewAnimationCurveEaseInOut animations:^{
  38. self.customIV.alpha = 0;
  39. } completion:^(BOOL finished) {
  40. }];
  41.  
  42. -(void)fadeOutIn
  43. {
  44. [UIView animateWithDuration:1
  45. delay:0.0
  46. options: UIViewAnimationOptionCurveEaseInOut
  47. animations:^{
  48. [[self contentView] emailField].alpha = 0.0;
  49. }
  50. completion:^(BOOL finished){
  51.  
  52. [UIView animateWithDuration:1
  53. delay:0.0
  54. options: UIViewAnimationOptionCurveEaseInOut
  55. animations:^{
  56. [[self contentView] emailField].alpha = 1.0;
  57. }
  58. completion:^(BOOL finished){
  59. [self fadeOutIn];
  60.  
  61. }];
  62. }];
  63. }
  64.  
  65. [UIView animateWithDuration:duration
  66. delay:0.0
  67. options: UIViewAnimationOptionRepeat| UIViewAnimationOptionAutoreverse|UIViewAnimationOptionCurveEaseInOut
  68. animations:^{
  69. view.alpha = 0.0;
  70. }
  71. completion:nil];
  72.  
  73. YourView.alpha = 1;// set the initial value of alpha
  74.  
  75. [UIView animateWithDuration:1 delay:0
  76. options: UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat
  77. animations:^{
  78. YourView.alpha = 0; // set the max value of alpha
  79. } completion:nil];
  80.  
  81. UIView.animateKeyframes(withDuration: 1, delay: 0, options: [UIView.KeyframeAnimationOptions(rawValue: UIView.AnimationOptions.repeat.rawValue), UIView.KeyframeAnimationOptions(rawValue: UIView.KeyframeAnimationOptions.RawValue(UIView.AnimationCurve.easeInOut.rawValue)), UIView.KeyframeAnimationOptions(rawValue: UIView.AnimationOptions.autoreverse.rawValue)] , animations: {
  82. self.logoCenterImageView.alpha = 0
  83. }) { finished in
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement