OliveappBlueFrame.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // OliveappBlueFrame.m
  3. // AppSampleYitu
  4. //
  5. // Created by kychen on 17/1/13.
  6. // Copyright © 2017年 Oliveapp. All rights reserved.
  7. //
  8. #import "OliveappBlueFrame.h"
  9. @implementation OliveappBlueFrame
  10. /**
  11. 闪动动画
  12. @param scaleSize 放大比例
  13. @param duration 动画时间
  14. */
  15. - (void)animationWithScale:(CGFloat)scaleSize
  16. withDuration:(CGFloat)duration {
  17. CATransform3D transform1 = self.layer.transform;
  18. CATransform3D transform2 = CATransform3DScale(transform1, scaleSize, scaleSize, 1);
  19. CAKeyframeAnimation * animation = [CAKeyframeAnimation animation];
  20. animation.keyPath = @"transform";
  21. animation.values = @[
  22. [NSValue valueWithCATransform3D:transform1],
  23. [NSValue valueWithCATransform3D:transform2],
  24. [NSValue valueWithCATransform3D:transform1]
  25. ];
  26. animation.duration = duration;
  27. animation.timingFunction = [[CAMediaTimingFunction alloc] initWithControlPoints:0.4f :0.0f :0.2f :0.1f];
  28. [self.layer addAnimation:animation forKey:nil];
  29. }
  30. @end