Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reset a layer transformation to the original state after I did some animations and transformations?

I have a image that rotates around a few times by random and then disappears. After it appears again, I want it to be in the original state. Not rotated. I would keep track of how many rotations I applied randomly and then calculate how many radians I have to re-do that. But I slightly remember from the big docs that there was some identity transformation thing. Is that what I am looking for? Just want to ask before I spent a whole day in finding it to then know it's not the right thing ;)

like image 211
Thanks Avatar asked May 16 '09 16:05

Thanks


2 Answers

In code, that will look like:

yourView.transform = CGAffineTransformIdentity;
like image 171
Thanks Avatar answered Oct 29 '22 14:10

Thanks


Yes, you want to set the transformation matrix to the identity transform; that will have the effect of "resetting" the transformation.

like image 22
Paul Sonier Avatar answered Oct 29 '22 16:10

Paul Sonier