实现 图片 X,Y, Z 三轴 持续旋转动画

实现  图片 X,Y, Z 三轴 持续旋转动画

直接上代码

// 如果是y, 则transform.rotation.z改为transform.rotation.y, x轴旋转也是一样

CABasicAnimation* rotationAnimation;

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

    rotationAnimation.toValue = [NSNumber numberWithFloat: (M_PI * 2.0)];

    rotationAnimation.duration = 3.0;

    rotationAnimation.removedOnCompletion = NO;

    rotationAnimation.repeatCount = MAXFLOAT;

    rotationAnimation.fillMode = kCAFillModeForwards;

    [self.imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

你可能感兴趣的:(实现 图片 X,Y, Z 三轴 持续旋转动画)