本文主要是介绍CABasicAnimation-旋转,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//旋转
- (void)animationRotation{//创建layerCALayer *layer =[CALayer layer];layer.bounds = CGRectMake(0, 0, 100, 100);layer.position = CGPointMake(100,100);layer.backgroundColor = [UIColor yellowColor].CGColor;[self.view.layer addSublayer:layer];CABasicAnimation *animation = [CABasicAnimation animation];animation.keyPath = @"transform";animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_4, 1, 1, 0)];animation.duration = 2;animation.removedOnCompletion = NO;animation.fillMode = @"forwards";[layer addAnimation:animation forKey:nil];}
这篇关于CABasicAnimation-旋转的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!