0
我想在我的應用程序中擁有這種動畫,這種情況下箭頭形狀可以在點擊時轉換爲標記。斯威夫特的動畫
這就是我使用以下
func handleTransform(){
let arrowPath = UIBezierPath()
arrowPath.move(to: CGPoint(x: 50, y: 0))
arrowPath.addLine(to: CGPoint(x: 25, y: 75))
arrowPath.addLine(to: CGPoint(x: 25, y: 75))
arrowPath.addLine(to: CGPoint(x: 25, y: 45))
arrowPath.addLine(to: CGPoint(x: 25, y: 35))
arrowPath.close()
let progressLines = CAShapeLayer()
progressLines.path = arrowPath.cgPath
progressLines.strokeColor = UIColor.black.cgColor
progressLines.fillColor = UIColor.clear.cgColor
progressLines.lineWidth = 10.0
progressLines.lineCap = kCALineCapRound
self.view.layer.addSublayer(progressLines)
let animateStrokeEnd = CABasicAnimation(keyPath: "strokeEnd")
animateStrokeEnd.duration = 3.0
animateStrokeEnd.fromValue = 0.0
animateStrokeEnd.toValue = 1.0
progressLines.add(animateStrokeEnd, forKey: "animate stroke end animation")
}
代碼具有在本流程中示出圖像中的波紋管
你有此按鈕後,嘗試簡單的「圖像轉換」開關圖像被點擊? – Vexy
@EricAya我已經添加了我嘗試做的代碼,沒有找到解決方案的地方 – SimpiMind
@Vexy我不認爲切換圖像會起作用,因爲第二個圖像比第一個圖像長一點 – SimpiMind