UIImage * image = [UIImage imageNamed:@"xqx.jpg"];
    self.imageView.image = image;
    
    CABasicAnimation * shake = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    shake.fromValue = [NSNumber numberWithFloat:-M_PI/45];//45可以修改,越小,摆动的幅度越大
    shake.toValue   = [NSNumber numberWithFloat:+M_PI/45];
    shake.duration = 0.1;//摆动一次耗时
    shake.autoreverses = YES;
    shake.repeatCount = 5;//摆动次数
    [self.imageView.layer addAnimation:shake forKey:@"shakeAnimation"];
    self.imageView.alpha = 1.0;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-08-25
猜你喜欢
  • 2021-10-23
  • 2022-02-09
  • 2021-06-09
  • 2021-11-20
  • 2022-01-28
  • 2022-12-23
相关资源
相似解决方案