CALayer不透明度动画无法正常运行

时间:2018-09-04 02:44:45

标签: ios objective-c caanimation

查看下面的代码。这是一个简单的动画,但是当我设置beginTime = AVCoreAnimationBeginTimeAtZero时,该动画无法正常工作,否则就可以了。

CABasicAnimation *animation = [CABasicAnimation 
animationWithKeyPath:@"opacity"];
animation.duration = 2.f;
// animation.beginTime = AVCoreAnimationBeginTimeAtZero;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
animation.fromValue = [NSNumber numberWithFloat:1.0];
animation.toValue = [NSNumber numberWithFloat:0];
animation.delegate = self;
[layer addAnimation:animation forKey:@"basicAnimation"];

0 个答案:

没有答案