関数circeAnimationの中のsetValueはanimationLayerとしてlayerに何の値をセットしているんですか?
swift
1 2 func circleAnimation(layer:CAShapeLayer){ 3 //アニメーションを行うプロパティ=今回はstrokeend(起点と終点を設定) 4 var drawAnimation = CABasicAnimation(keyPath: "strokeEnd") 5 6 drawAnimation.setValue(layer, forKey: "animationLayer") 7 drawAnimation.delegate = self 8 9 drawAnimation.duration = 1.0 10 drawAnimation.repeatCount = 1.0 11 drawAnimation.fromValue = 0.0 12 drawAnimation.toValue = 1.0 13 14 drawAnimation.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaseOut) 15 16 layer.add(drawAnimation, forKey: "circleAnimation") 17 18 19 20 } 21 override func animationDidStop(anim:CAAnimation!, finished flag:Bool ){ 22 let layer:CAShapeLayer = anim.valueForKey("animationLayer") as CAShapeLayer 23 countDownNum -= 1 24 countNumberLabel.text = String(countDownNum) 25 26 if countDownNum <= 0 { 27 28 }else{ 29 circleAnimation(layer: layer) 30 } 31 } 32 33 34 override func didReceiveMemoryWarning() { 35 super.didReceiveMemoryWarning() 36 // Dispose of any resources that can be recreated. 37 } 38 39 40 /* 41 // MARK: - Navigation 42 43 // In a storyboard-based application, you will often want to do a little preparation before navigation 44 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 45 // Get the new view controller using segue.destinationViewController. 46 // Pass the selected object to the new view controller. 47 } 48 */ 49 50} 51
あなたの回答
tips
プレビュー