iOS 13 CATransform3D issues

為{幸葍}努か 提交于 2020-01-25 06:49:09

问题


Prior to the release of iOS 13, I had had some CATransform3D code inside a UIView.animate block. In iOS 12, the result of the transformation animation looked like this: https://youtu.be/mfIzjjlKOBM. In iOS 13, the same transformation code now gives this result: https://youtu.be/hQdyGactIfA.

As you can see in iOS 13 the animation is no longer a fluid cube movement like it is in iOS 12. Here's my basic code:

UIView.animate(withDuration: duration, delay: 0, options: .curveEaseOut, animations: {
    view.layer.transform = entryTransformation
    view.alpha = 1
    previousElementView.layer.transform = exitTransformation
    previousElementView.alpha = 0.2
}, completion: nil)

And here are what the values look like for entryTransformation and exitTransformation (screen height is 896). Both of the transformation values (and anchor points) remain exactly the same from iOS 12 to iOS 13.

   // entryTransformation
   // anchor point: (x: 0.5, y: 0.5)
   CATransform3D
      - m11 : 1.0
      - m12 : 0.0
      - m13 : 0.0
      - m14 : 0.0
      - m21 : 0.0
      - m22 : 1.0
      - m23 : 0.0
      - m24 : 0.0
      - m31 : 0.0
      - m32 : 0.0
      - m33 : 1.0
      - m34 : 0.0
      - m41 : 0.0
      - m42 : 0.0
      - m43 : 0.0
      - m44 : 1.0


   // exitTransformation
   // anchor point: (x: 0.5, y: 0.0)
   CATransform3D
      - m11 : 1.0
      - m12 : 0.0
      - m13 : 0.0
      - m14 : 0.0
      - m21 : 0.0
      - m22 : 0.896
      - m23 : -1.0
      - m24 : 0.001
      - m31 : 0.0
      - m32 : 1.0
      - m33 : 0.0
      - m34 : 0.0
      - m41 : 0.0
      - m42 : 896.0
      - m43 : 0.0
      - m44 : 1.0

Here is what each of the layers transform properties look like just before calling the animation (again, these values remain the same in both iOS versions):

   // for the view/layer entering the scene
   // anchor point: (x: 0.5, y: 1.0)
   CATransform3D
      - m11 : 1.0
      - m12 : 0.0
      - m13 : 0.0
      - m14 : 0.0
      - m21 : 0.0
      - m22 : -0.896
      - m23 : -1.0
      - m24 : -0.001
      - m31 : 0.0
      - m32 : -1.0
      - m33 : 0.0
      - m34 : 0.0
      - m41 : 0.0
      - m42 : -896.0
      - m43 : 0.0
      - m44 : 1.0


   // for the view/layer exiting the scene
   // anchor point: (x: 0.5, y: 0.5)
   CATransform3D
      - m11 : 1.0
      - m12 : 0.0
      - m13 : 0.0
      - m14 : 0.0
      - m21 : 0.0
      - m22 : 1.0
      - m23 : 0.0
      - m24 : 0.0
      - m31 : 0.0
      - m32 : 0.0
      - m33 : 1.0
      - m34 : 0.0
      - m41 : 0.0
      - m42 : 0.0
      - m43 : 0.0
      - m44 : 1.0

I am not sure what changes Apple made to Core Animation around the CATransform3D struct (if any) but I was wondering if anyone else is experiencing this type of issue and/or knows a work around.

Thanks for reading.

来源:https://stackoverflow.com/questions/58514193/ios-13-catransform3d-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!