相关动画

1.设置View顺时针旋转

//音乐播放旋转

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

//默认是顺时针效果,若将fromValue和toValue的值互换,则为逆时针效果

animation.fromValue = [NSNumber numberWithFloat:0.f];

animation.toValue =  [NSNumber numberWithFloat: M_PI *2];

animation.duration  = 5;//旋转时间5s一轮

animation.autoreverses = NO;

animation.fillMode =kCAFillModeForwards;

animation.repeatCount = MAXFLOAT; //如果这里想设置成一直自旋转,可以设置为MAXFLOAT,否则设置具体的数值则代表执行多少次

[bottomView.layer addAnimation:animation forKey:nil];

2.点击button放大再缩小的功能

-(void)rightButtonClick:(UIButton*)sender{

        sender.transform = CGAffineTransformIdentity;

        [UIView animateKeyframesWithDuration:0.5 delay:0 options:0 animations: ^{

         [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 / 3.0 animations: ^{

        sender.transform = CGAffineTransformMakeScale(1.5, 1.5);

       }];

      [UIView addKeyframeWithRelativeStartTime:1/3.0 relativeDuration:1/3.0 animations: ^{

      sender.transform = CGAffineTransformMakeScale(0.8, 0.8);

      }];

       [UIView addKeyframeWithRelativeStartTime:2/3.0 relativeDuration:1/3.0 animations: ^{

      sender.transform = CGAffineTransformMakeScale(1.0, 1.0); 

       }];

       } completion:nil];

  }


3.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容