我试图让我的视图旋转,只要它通过路径(线性路径),但它不会旋转。
这是我的代码:
CAKeyframeAnimation *animKF = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animKF.values = [NSArray arrayWithObjects:[NSValue valueWithCGPoint:CGPointMake(100, 100)], [NSValue valueWithCGPoint:CGPointMake(400, 400)], [NSValue valueWithCGPoint:CGPointMake(700, 100)], [NSValue valueWithCGPoint:CGPointMake(1000, 400)], nil];
animKF.keyTimes = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.25], [NSNumber numberWithFloat:0.5], [NSNumber numberWithFloat:1.0], nil];
animKF.duration = 6;
animKF.rotationMode = kCAAnimationRotateAuto;
[imageView.layer addAnimation:animKF forKey:@"keyframe"];
但是imageView(图中蓝脸)并没有沿路径旋转(图中红线)
太感谢了。