Анимированный цвет фона UIButton от WhiteColor до RedColor
Я пытаюсь сделать своего рода эффект цветового импульса, анимирующий цвет фонаUIButton
чтобы он непрерывно менял цвет (WhiteColor) на другой (RedColor). Я пытаюсь использоватьCABasicAnimation
для изменения непрозрачности, но я не могу заставить его работать с цветом тоже.
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration=1.0;
theAnimation.repeatCount=HUGE_VALF;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
theAnimation.toValue=[NSNumber numberWithFloat:0.0];
[BigButton.layer addAnimation:theAnimation forKey:@"animateOpacity"];
Каждое предложение будет оценено. Спасибо