CABasicAnimation:为层的属性提供了简单的插值

    //需要改变的属性
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"cornerRadius"];
    animation.fromValue=[NSNumber numberWithFloat:0.0f];
    animation.toValue=[NSNumber numberWithFloat:40.0f];
    //执行时间
    animation.duration = 10.0;
    //执行次数
    animation.repeatCount=2;

    [layer addAnimation:animation forKey:@"change"]; 


     

    CABasicAnimation* rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];

//角度转弧度

rotationAnimation.toValue = [NSNumber numberWithFloat:(DEGREES_TO_RADIANS(160))];

rotationAnimation.duration = 1.0f;

//回退动画

rotationAnimation.autoreverses = YES; 

//动画开始结束的快慢,设置为加速

rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

[pinLayer addAnimation:rotationAnimation forKey:@"revItUpAnimation"];

Core Animation学习笔记二:CABasicAnimation

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2021-11-16
  • 2022-02-13
  • 2021-05-26
  • 2021-08-01
猜你喜欢
  • 2022-12-23
  • 2021-11-24
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案