• 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: Group CGAffineTransform Animations?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Group CGAffineTransform Animations?


  • Subject: Re: Group CGAffineTransform Animations?
  • From: David Duncan <email@hidden>
  • Date: Thu, 18 Jun 2009 11:19:41 -0700

On Jun 18, 2009, at 11:01 AM, WT wrote:

Ultimately, I have some rectangular area on the 2D screen of an iPhone or a Mac, and it has a center point (which, I understand, doesn't *have* to be halfway through the bounds), whose coordinates are measured in the coordinate system of the rectangle's superview. I then apply a translation to this rectangle and it ends up somewhere else on that screen. Assuming that the rectangle's superview was not translated along as well, I cannot see how the coordinates of the rectangle's center would not have changed.


Your confusing the geometric center of the view's rectangle with the center property of the view. Specifically in code if you do this:

CGPoint c = view.center;
view.transform = CGAffineTransformMakeTranslation(20, 20);
CGPoint visualCenter = CGPointMake(CGRectGetMidX(view.frame), CGRectGetMidY(view.frame));
CGPoint c2 = view.center;


Then you will find that c == c2, c != visualCenter, and c2 != visualCenter.

This is why using translations for transforms is very confusing. You expect the center of the view to change, but it does not. This is by design.
--
David Duncan
Apple DTS Animation and Printing


_______________________________________________

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


  • Follow-Ups:
    • Re: Group CGAffineTransform Animations?
      • From: WT <email@hidden>
References: 
 >Re: Group CGAffineTransform Animations? (From: Erik Buck <email@hidden>)
 >Re: Group CGAffineTransform Animations? (From: WT <email@hidden>)
 >Re: Group CGAffineTransform Animations? (From: David Duncan <email@hidden>)
 >Re: Group CGAffineTransform Animations? (From: WT <email@hidden>)
 >Re: Group CGAffineTransform Animations? (From: David Duncan <email@hidden>)
 >Re: Group CGAffineTransform Animations? (From: WT <email@hidden>)

  • Prev by Date: Re: MDSchemaCopyAllAttributes() returning nil
  • Next by Date: Re: NSInterger Infinity?
  • Previous by thread: Re: Group CGAffineTransform Animations?
  • Next by thread: Re: Group CGAffineTransform Animations?
  • Index(es):
    • Date
    • Thread