Mit dem folgenden Code, ich bin ein CALayer animieren können von links nach rechtsCABasicAnimation: Von links nach rechts
let imageLayer = CALayer()
imageLayer.frame = CGRect(x: 0, y: 500, width: 100, height: 70)
imageLayer.contents = UIImage(named: "first_image")?.cgImage
let animation = CABasicAnimation()
animation.keyPath = "position.x"
animation.fromValue = 100
animation.toValue = 300
animation.duration = 3
animation.fillMode = kCAFillModeForwards
animation.isRemovedOnCompletion = true
animation.repeatCount = 2
imageLayer.add(animation, forKey: "basic")
self.view.layer.addSublayer(imageLayer)
Was ich versuche zu tun, in
Zyklus : 1 - "first_image" wird von links nach rechts
und in
bewegenZyklus: 2 - "second_image" (dies ist ein anderes Bild) bewegt sich von links nach rechts wie vorheriger Zyklus.
Hier Zyklus: 1 + Zyklus: 2 ist eigentlich eine einzelne Animation und ich möchte diese Animation für eine Reihe von Zeiten geschehen. Wie erreiche ich das? Jede Hilfe wäre willkommen.