我正在使用CABasicAnimation尝试动画我的根级视图图层并且它不会动画。动画发生在大约0.2而不是我下面的77.0。
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
animation.beginTime = 1.0;
animation.duration = 77.0;
animation.fromValue = [NSNumber numberWithFloat:0.0f];
animation.toValue = [NSNumber numberWithFloat:1.0f];
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeBoth;
animation.additive = NO;
[self.layer addAnimation:animation forKey:@"show-anim" ];
答案 0 :(得分:1)
您需要相对于当前媒体时间设置开始时间:
animation.beginTime = CACurrentMediaTime() + 1;