How can I slow down the CALayer.transform animation?
<p>I currently have to a layer (CALayer) that I scale between these scales to create an animation.</p>

<pre><code>private let invisibleScale = CATransform3DMakeScale(0.0,0.0,1.0)
private let fullScale = CATransform3DMakeScale(2.5,2.5,1.0)
</code></pre>

<p>By simply calling the below functions on my layer the layer animates just like I want it to (except a bit to fast).</p>

<pre><code>animationLayer.transform = invisibleScale
animationLayer.transform = fullScale
</code></pre>

<p>I have tried to add CABasicAnimation with the transform as the value but that doesn't work since it goes back to the original scale after finishing the animation. Something like this:</p>

<pre><code>let animation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue(caTransform3D: invisibleScale)
animation.duration = animationDuration
animationLayer.add(animation, forKey: "transform")
</code></pre>

<p>So I tried adding the animationLayer.transform = fullScale at the end to update the state after the animation.</p>

<pre><code>let animation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue(caTransform3D: invisibleScale)
animation.duration = animationDuration
animationLayer.add(animation, forKey: "transform")
animationLayer.transform = fullScale
</code></pre>

<p>This results in an animation that looks exactly the same as just calling:</p>

<pre><code>animationLayer.transform = fullScale
</code></pre>

<p>I've also tried stuff like:</p>

<pre><code>UIView.animate(withDuration: 10) {
        self.animationLayer.transform = fullScale
}
</code></pre>

<p>That also animates with the same speed as just typing animationLayer.transform = invisibleScale.</p>

<p>Any tips for how to make this work would be much appreciated!</p>