I'm running into some very weird behavior with CAAnimation that I'm trying to understand. I've managed to boil it down to a simple reproduction case:
- Create a simple
CAKeyframeAnimation
withkeyPath="transform"
- Create a
CATransform3D
which is any multiple of the identity matrix (except 0 or 1). Let's say0.5I
for this example, so every diagonal entry is 0.5. - Set this matrix as the value for any number of frames.
- Add the animation to some view's layer.
(Sorry, I'm working in Xamarin, so unfortunately no copy-paste Swift / ObjC code sample; I have exactly zero experience in these languages).
If you assign the transform I just described to a layer directly through (layer.transform = transform
) it behaves as expected - nothing happens. The matrix is a multiple of the identity matrix, so after division over the homogeneous coordinate input / output points should be identical. As key frames of an animation, however, the matrix scales the layer to half its size (or whatever factor you chose).
I am stumped as to why this is happening and am hoping somebody can shed some light on this situation.