OliveappHintView.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // OliveappHintView.m
  3. // AppSampleYitu
  4. //
  5. // Created by kychen on 17/1/16.
  6. // Copyright © 2017年 Oliveapp. All rights reserved.
  7. //
  8. #import "OliveappHintView.h"
  9. @implementation OliveappHintView
  10. - (CABasicAnimation *)animationWithScale:(CGFloat)scale
  11. withDuration:(CGFloat)duration
  12. withDelay:(CGFloat)delay
  13. withTimeFunction:(CAMediaTimingFunction *)fn
  14. withDelegate: (id) delegate {
  15. CATransform3D transform1 = self.layer.transform;
  16. CATransform3D transform2 = CATransform3DMakeScale(scale, scale, 1);
  17. self.layer.transform = transform2;
  18. CABasicAnimation * animation = [CABasicAnimation animation];
  19. animation.fromValue = [NSValue valueWithCATransform3D:transform1];
  20. animation.keyPath = @"transform";
  21. animation.toValue = [NSValue valueWithCATransform3D:transform2];
  22. animation.duration = duration;
  23. animation.beginTime = CACurrentMediaTime() + delay;
  24. animation.timingFunction = fn;
  25. animation.delegate = delegate;
  26. animation.removedOnCompletion = NO;
  27. [self.layer addAnimation:animation forKey:@"hintView"];
  28. return animation;
  29. }
  30. @end