I've created animation ( CABasicAnimation(keyPath = "position.x") )
using 40 images. per image duration is 3 seconds. So, total duration of the core animation is 120 seconds inside a CALayer.
I'm using a UISlider to perform seek operation . For example when slider value is 5, I need to display image which came/ will come exactly in 5 second and continue core animation as well.
How to perform forward and backward seek operation inside core animation?
Here is my code for animation
let animation = CABasicAnimation()
animation.keyPath = "position.x"
animation.fromValue = -viewSize.width
animation.toValue = (viewSize.width)/2
animation.duration = 3
animation.speed = 1 // 1 is default actually
animation.beginTime = CACurrentMediaTime() + animationTimes[index-1] // here animationTimes is array like [0,3,6,9 ...... so on]
animation.fillMode = CAMediaTimingFillMode.forwards
animation.isRemovedOnCompletion = false
blackLayer.add(animation, forKey: "basic"). // here per blackLayer contain individual imageLayer and animation
parentLayer.addSublayer(blackLayer)