We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我仔细看了下代码,按照那里的写法的确能够成功执行。但是我发现
- (void)setAngle:(CGFloat)angle forHand:(UIView *)handView animated:(BOOL)animated { //generate transform CATransform3D transform = CATransform3DMakeRotation(angle, 0, 0, 1); if (animated) { //create transform animation CABasicAnimation *animation = [CABasicAnimation animation]; [self updateHandsAnimated:NO]; animation.keyPath = @"transform"; animation.toValue = [NSValue valueWithCATransform3D:transform]; animation.duration = 0.5; animation.delegate = self; [animation setValue:handView forKey:@"handView"]; [handView.layer addAnimation:animation forKey:nil]; } else { //set transform directly handView.layer.transform = transform; } }
这段代码里面 修改成
- (void)setAngle:(CGFloat)angle forHand:(UIView *)handView animated:(BOOL)animated { //generate transform CATransform3D transform = CATransform3DMakeRotation(angle, 0, 0, 1); handView.layer.transform = transform; }
一样能成功执行,因为以上代码主要的作用只是做了一个transform转换,并没有达到CABasicAnimation的目的。我觉得其实作者想要实现的效果应该是
- (void)setAngle:(CGFloat )angle forHand:(UIImageView *)handView animated:(BOOL)animated { CATransform3D transform = CATransform3DMakeRotation(angle, 0, 0, 1); if (animated) { CABasicAnimation *animation = [CABasicAnimation animation]; animation.keyPath = @"transform"; animation.toValue = [NSValue valueWithCATransform3D:transform]; animation.duration = 0.5; animation.fillMode = kCAFillModeForwards; animation.removedOnCompletion = NO; [handView.layer addAnimation:animation forKey:nil]; } else { handView.layer.transform = transform; } }
作者可以参考下
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我仔细看了下代码,按照那里的写法的确能够成功执行。但是我发现
这段代码里面 修改成
一样能成功执行,因为以上代码主要的作用只是做了一个transform转换,并没有达到CABasicAnimation的目的。我觉得其实作者想要实现的效果应该是
作者可以参考下
The text was updated successfully, but these errors were encountered: