For my understanding, beginTime can be used to say \"hey, start at exactly 12:00 \'o clock\". But how would I tell this with an CFTimeInterval type? I thought that this one is n
You first need to convert to the layer's timespace like so:
let currentLayerTime = myLayer.convertTime(CACurrentMediaTime(), from: nil)
Then you can set the beginTime
relative to the layer's now time. For instance, to make an animation begin in 2s:
myAnimation.beginTime = currentLayerTime + 2
You'll also likely want to set the fillMode
to .backwards
, so that you can set the final property value before you add the animation:
myAnimation.fillMode = .backwards
myLayer.someProperty = someFinalValue
myLayer.addAnimation(myAnimation, forKey: "myAnimationName")