• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the true rotation of a UIView layer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the true rotation of a UIView layer


  • Subject: Re: Getting the true rotation of a UIView layer
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Wed, 15 Mar 2017 04:14:40 +0000

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*
*}*
*print("final: \(testAngle)º")*

Seems to be spot on.


On Tue, Mar 14, 2017 at 11:41 PM Eric E. Dolecki <email@hidden> wrote:

> I don't follow.
>
> On Tue, Mar 14, 2017 at 11:29 PM Graham Cox <email@hidden>
> 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 <email@hidden> wrote:
> >
> > Once done (I dispatch after the randomSpeed duration), I'd like to
> > determine the angle it's currently at.
> >
> > *let transform:CATransform3D = innerRing.layer.transform*
> > *let angle: CGFloat = atan2(transform.m12, transform.m11);*
> > *print(angle)*
> >
> > Always prints 0.0
> >
> > Am I missing something obvious? I almost thought about using hitTest but
> > there must be a way to get this after each spin?
> >
> > Thank you,
> > Eric
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Getting the true rotation of a UIView layer (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Getting the true rotation of a UIView layer (From: Graham Cox <email@hidden>)
 >Re: Getting the true rotation of a UIView layer (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Getting the true rotation of a UIView layer
  • Next by Date: Re: Getting the true rotation of a UIView layer
  • Previous by thread: Re: Getting the true rotation of a UIView layer
  • Next by thread: Re: Getting the true rotation of a UIView layer
  • Index(es):
    • Date
    • Thread