3
불투명도가 약 0.2 초에서 0으로 1이되도록 레이어를 애니메이션으로 만들려고합니다. 불투명도를 1로 유지하고 초당 불투명도를 0으로 설정합니다. 키 시간을 사용하려고합니다. 그것을해라. 그러나 나는 그것을 올바르게 할 수 없다.CAKeyFrameAnimation에서 키 타임을 사용하여 레이어의 불투명도를 애니메이션으로 적용하려면 어떻게해야합니까?
CAKeyframeAnimation *opacityLabel = [CAKeyframeAnimation animationWithKeyPath: @"opacity"];
// 0.2 seconds fade in, 1 second hold, 0.2 seconds fade out
[opacityLabel setDuration: 1.4];
[opacityLabel setDelegate: self];
[opacityLabel setValue: @"countLabel" forKey: @"verify"];
[opacityLabel setValues: [NSArray arrayWithObjects: [NSNumber numberWithFloat: 1.0], [NSNumber numberWithFloat: 1.0], [NSNumber numberWithFloat: 0], nil]];
[opacityLabel setKeyTimes: [NSArray arrayWithObjects: [NSNumber numberWithFloat: 0.2], [NSNumber numberWithFloat: 1.2], [NSNumber numberWithFloat: 1.4], nil]];
[[tomorrowCountLabel layer] addAnimation: opacityLabel forKey: @"opacityUp"];
@aLevelOfInderection 감사합니다! – bbraunj
이 방법을 사용하면 대답을 수락하는 것을 잊지 마십시오. – aLevelOfIndirection