Why does the Layer View Transform represent the state of the completed animation while the animation is running?
The documentation says:
The view tree contains the values that are being presented to the user as the animation takes place. For example, setting a new value for the backgroundColor layer immediately changes the value in the layer tree. However, the backgroundColor value on the corresponding layer in the view tree will be updated with the interpolated colors as they are displayed to the user.
Now this is true from my tough 8 hour sandbox testing with a single view and animation. During animation, I ask:
CATransform3D currentTransform = [(CALayer *) [self.layer presentationLayer] transform]
I am checking the m11 and m12 values of currentTransform to calculate the current rotation angle.
When I set up to rotate 90 degrees, two things happen and the animation happens and doesn't end:
-
sometimes my calculated angle based on currentTransform is 0.0 even though the view is rotated by some angle and definitely not 0.0.
-
and sometimes (most often) it's just a target value of 90 degrees.
But I never get what I want: the current state in the animation. I have searched the net for a while and developers seem to rarely use this. So a structural error, or an error in the documentation, or my code above to get the current visible transformation is completely wrong.
a source to share
I know that I pulled a frame from the presentation layer to find the location of the screen on the screen during animation. It definitely works.
I used it to stop the animation and then update the current view with a view tier frame.
It should work, I think you will need to post your specific code to figure it out.
a source to share