我正在尝试使用CABasicAnimation来改变Opacity,但我也无法使用颜色.
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"];
我们将不胜感激.
谢谢
目标C.
CABasicAnimation *theAnimation=[CABasicAnimation animationWithKeyPath:@"backgroundcolor"];theAnimation.duration=1.0;theAnimation.repeatCount=HUGE_VALF;theAnimation.autoreverses=YES;theAnimation.fromValue= [[UIcolor redcolor] CGcolor];theAnimation.tovalue= [[UIcolor bluecolor] CGcolor];[Bigbutton.layer addAnimation:theAnimation forKey:@"colorpulse"];
迅速
let colorAnimation = CABasicAnimation(keyPath: "backgroundcolor")colorAnimation.fromValue = UIcolor.redcolor().CGcolorcolorAnimation.tovalue = UIcolor.bluecolor().CGcolorcolorAnimation.duration = 1colorAnimation.autoreverses = truecolorAnimation.repeatCount = FLT_MAXself.layer.addAnimation(colorAnimation,forKey: "colorpulse")总结
以上是内存溢出为你收集整理的ios – 从WhiteColor到RedColor的UIButton的背景颜色动画全部内容,希望文章能够帮你解决ios – 从WhiteColor到RedColor的UIButton的背景颜色动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)