FROM : Nicko van Someren
DATE : Sat Dec 01 23:43:55 2007
On 1 Dec 2007, at 17:10, John Harper wrote:
> Presumably you did what the samples do and set the perspective
> matrix as the sublayerTransform property of the superlayer of the
> layer you're rotating?
Yes, that's right.
> Both sublayerTransform and transform properties are applied relative
> to the anchor point (typically center, though appkit sets the anchor
> of layers it creates to the bottom left corner iirc) of the layer
> the property is set on. So if you have two layers, one with a
> perspective matrix, and its child rotated around the Y axis by 90°,
> you will only see the child layer exactly edge on when its center is
> aligned with the center of its superlayer. Does that explain what
> you're seeing?
Aha. Thank you. That explains what I'm seeing exactly. The image
that was being rotated was off-centre in the layer that contained the
perspective transformation and turning it though 90 degrees left it
"pointing towards the origin" in the parent layer. Adding an
intermediate (empty) layer, moving the perspective transform up to the
intermediate layer and then centring the later containing the image to
be rotated in that layer now allows the image to rotate as I would
expect.
I've filled a bug report on the documentation for this, since there is
currently no description of the nature of the transformations that
take place.
Thanks again for the help,
Nicko
DATE : Sat Dec 01 23:43:55 2007
On 1 Dec 2007, at 17:10, John Harper wrote:
> Presumably you did what the samples do and set the perspective
> matrix as the sublayerTransform property of the superlayer of the
> layer you're rotating?
Yes, that's right.
> Both sublayerTransform and transform properties are applied relative
> to the anchor point (typically center, though appkit sets the anchor
> of layers it creates to the bottom left corner iirc) of the layer
> the property is set on. So if you have two layers, one with a
> perspective matrix, and its child rotated around the Y axis by 90°,
> you will only see the child layer exactly edge on when its center is
> aligned with the center of its superlayer. Does that explain what
> you're seeing?
Aha. Thank you. That explains what I'm seeing exactly. The image
that was being rotated was off-centre in the layer that contained the
perspective transformation and turning it though 90 degrees left it
"pointing towards the origin" in the parent layer. Adding an
intermediate (empty) layer, moving the perspective transform up to the
intermediate layer and then centring the later containing the image to
be rotated in that layer now allows the image to rotate as I would
expect.
I've filled a bug report on the documentation for this, since there is
currently no description of the nature of the transformations that
take place.
Thanks again for the help,
Nicko
| Related mails | Author | Date |
|---|---|---|
| Nicko van Someren | Nov 7, 20:27 | |
| John Harper | Dec 1, 18:10 | |
| Nicko van Someren | Dec 1, 23:43 |






Cocoa mail archive

