• 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: CALayer transform, setting the Y value of rotation causes side-effects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALayer transform, setting the Y value of rotation causes side-effects


  • Subject: Re: CALayer transform, setting the Y value of rotation causes side-effects
  • From: John Clayton <email@hidden>
  • Date: Tue, 15 Jul 2008 06:57:18 +0200

Hi Duncan

Thanks for the answer - it does make sense (also in light of the other replies to the same post). In my app, I've attached a simple 360 degree slider to the Y property, and I'd like that to rotate my layer smoothly through the Y axis by 360 degrees. What I'm seeing then, is that as soon as I get past 90 degrees, the solver returns these 'flipped' values for all three properties and the image jitters badly.

I must have stuffed something up though; because if the solver is returning matrices that are 'equivalent' or mathematically equal - then I should not see any visual difference in the rotation of the layer on screen. But I do see visual differences.

The best way to see what i mean is a short vid; I first set the Y rotation to 5 degrees, it looks OK, then I move the slider past 90, and its this jitter that I want to eliminate. The video is at:
http://gallery.me.com/john_clayton#100148


The code is pretty simple, its a binding that goes through a ValueTransformer - converting degrees to radians for a range of 0 > degrees < 360, which then drives a simple setter on the CALayer instance, that in turn modifies the "transform.rotation.x/y/z" properties in turn.

Cheers - your help is [hugely] appreciated.

--
John Clayton

On 14/07/2008, at 8:35 PM, David Duncan wrote:

On Jul 14, 2008, at 9:57 AM, John Clayton wrote:

Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here? I'm a little stumped by this one.


The simple answer is that with a 4x4 rotation matrix, there are a number of distinct matrices that are mathematically equivalent. Note that 3.14 - 2.12 = 1.02 and that X & Z were flipped 180 degrees. Effectively your seeing the solver for reversing an arbitrary 4x4 matrix into x/y/z rotations making certain simplifying assumptions that don't match what you are expecting.
--
David Duncan
Apple DTS Animation and Printing
email@hidden





_______________________________________________

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: 
 >CALayer transform, setting the Y value of rotation causes side-effects (From: John Clayton <email@hidden>)
 >Re: CALayer transform, setting the Y value of rotation causes side-effects (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Questions about Core Data and SQLite
  • Next by Date: Re: Questions about Core Data and SQLite
  • Previous by thread: Re: CALayer transform, setting the Y value of rotation causes side-effects
  • Next by thread: Re: CALayer transform, setting the Y value of rotation causes side-effects
  • Index(es):
    • Date
    • Thread