uicolor - Swift- animate CAshapeLayer stroke color -
am
I tried to find a way to stroke that I make
color conscious I circleLayer = CAShapeLayer () circleLayer.path = circlePath.CGPath circleLayer.lineCap = kCALineCapRound circleLayer.fillColor = UIColor.clearColor (). Fill CGColor CABasicAnimation = CABasicAnimation CircleLayer.strokeColor = UIColor (red: 0.4, green: 1.0, blue: 0.2, alpha: 0.5) .cg collar layer.lengthwidth = 20.0; circleLayer.lineJoin = kCALineJoinRound // Add circleLayer do not start circleLayer.strokeEnd = 0.0 // sublayers visual layer layer.addSublayer (circleLayer) circle
What is the I want while it is being built (I'm making over a period of 1 second), the color will enliven themselves
Enjoy explored solutions. You definitely take a CAShapeLayer:
to animcolor = CABasicAnimation (keypath: "strokeColor") animcolor.fromValue = UIColor.greenColor () CGColor animcolor.toValue = UIColor.orangeColor () .. CGColor animcolor.duration = 1.0; Animcolor.repeatCount = 0; animcolor.autoreverses = true circleLayer.addAnimation (animcolor, forKey: "strokeColor")
Comments
Post a Comment