【发布时间】:2014-10-28 09:17:18
【问题描述】:
我正在尝试找到一种方法来为我正在创建的笔画的颜色设置动画
circleLayer = CAShapeLayer()
circleLayer.path = circlePath.CGPath
circleLayer.lineCap = kCALineCapRound
circleLayer.fillColor = UIColor.clearColor().CGColor
CABasicAnimation fill = CABasicAnimation.
circleLayer.strokeColor = UIColor(red: 0.4, green: 1.0, blue: 0.2, alpha: 0.5).CGColor
circleLayer.lineWidth = 20.0;
circleLayer.lineJoin = kCALineJoinRound
// Don't draw the circle initially
circleLayer.strokeEnd = 0.0
// Add the circleLayer to the view's layer's sublayers
layer.addSublayer(circleLayer)
我想要实现的是:当它被创建时(我在 1 秒的时间内创建它),颜色会自动生成动画。
【问题讨论】:
-
这看起来与您之前的问题 stackoverflow.com/questions/26602171/… 完全相同。如果您没有得到答案,请尝试改进问题,提供更多信息,......但不要简单地重复。
-
@MartinR 我教它被删除了哦。我可以删除这个马丁吗?
标签: swift uicolor uianimation cashapelayer stroke