Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
Hmm, you’ll need to use the CGAffineTransform because it has a richer set of functions than CATransform3D. This will only work if the 3D transform can be converted to a CGAffineTransform, which it can if the rotation is purely in the 2D plane - i.e. no Z transformations. CGAffineTransform cgt

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
Alright, I got something now that I believe works. *let transform:CATransform3D = innerRing.layer.presentation()!.transform* *let angle: CGFloat = atan2(transform.m12, transform.m11)* *var testAngle = radiansToDegress(radians: angle)* *if testAngle < 0 {* *testAngle = 360 + testAngle* *}* *pri

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I don't follow. On Tue, Mar 14, 2017 at 11:29 PM Graham Cox wrote: > Get the final transform, then use it to transform an angle of 0. The > result is the angle. > > —Graham > > > > > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki wrote: > > > > Once done (I dispatch after the randomSpeed duration)

Re: Getting the true rotation of a UIView layer

2017-03-14 Thread Graham Cox
Get the final transform, then use it to transform an angle of 0. The result is the angle. —Graham > On 15 Mar 2017, at 2:13 PM, Eric E. Dolecki wrote: > > Once done (I dispatch after the randomSpeed duration), I'd like to > determine the angle it's currently at. > > *let transform:CATransfo

Getting the true rotation of a UIView layer

2017-03-14 Thread Eric E. Dolecki
I have a view that I am rotating a lot, often more than 360 degrees (spins around a few times). Each time it stops, I want to determine the resulting "visual" angle. How do I go about doing that? rotateView is a configured CABasicAnimation: *let rotateView = CABasicAnimation()* *let randonAngle =