美文网首页
实现 图片 X,Y, Z 三轴 持续旋转动画

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

作者: 天下林子 | 来源:发表于2017-12-27 10:48 被阅读94次

实现  图片 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 三轴 持续旋转动画

      本文链接:https://www.haomeiwen.com/subject/tynygxtx.html