Animating UIView transforms.

Setting the transform property of a UIView in an animation block to a singular transform causes the animation to fail. This might be a reasonable restriction, but I haven't found it documented anywhere. Is there documentation describing restrictions to view.transfrm = SomeAffineTransform in animations?

Answered by Frameworks Engineer in 73193022

I'm unaware of all of the criteria (and don't think its documented), but singularity is a big breaker for animations, because singular matricies are a big one because they cannot be inverted, and we often need to invert the matrix in order to do the animation.


More generally, any matrix with a determinate of 0 would probaby have similar problems.

The transform matrix should be affine. What are you doing that is failing?

Anything that collapses a dimension to zero, like setting x and y scale to zero or a transform like:


view.transform = CGAffineTransformMake(1, 1, 1, 1, 0, 0);

Yea, thats not supported for animating, as these matricies don't obey criteria necessary to do an animation.


Instead either use the closest matrix that approximates the effect (such as scale=0.001) or use a bounds animation instead.

Thanks for the reply -- those are the two kinds of workaround I had come up with. But my question was where can I find the criteria matrices need to obey to do an animation explicitely stated in documentation -- either reference pages or programming guides?

Accepted Answer

I'm unaware of all of the criteria (and don't think its documented), but singularity is a big breaker for animations, because singular matricies are a big one because they cannot be inverted, and we often need to invert the matrix in order to do the animation.


More generally, any matrix with a determinate of 0 would probaby have similar problems.

OK, that's what Ithought. Thanks again.

Animating UIView transforms.
 
 
Q