首页 > 解决方案 > CALayer 不透明动画没有按我的意愿工作

问题描述

看看下面的代码。这是一个简单的动画,但是当我设置 时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"];

标签: iosobjective-ccaanimation

解决方案


推荐阅读