开发者

XCode translate matrix ala ActionScript?

开发者 https://www.devze.com 2023-01-03 19:44 出处:网络
I am wondering if there is a way to translate the underlying matrix of a layer much like you can in ActionScript3.

I am wondering if there is a way to translate the underlying matrix of a layer much like you can in ActionScript3.

In AS3 I can get the transform of a layer and shift it to, let's say, make the center of the layer the anchor point, rather than the upper-left corner.

The reason I ask is because I am trying to rotate a layer (containing a square) along a diagonal axis. I thought it might be easy if I could rotate the matrix by 45 degrees, then I could just rotate around the X-axis and be done.

But I cannot figure out how to do 开发者_运维知识库that.

Any help, greatly appreciate, as always.

Cheers,

Chris


Use a CGAffineTransform.

Edit:

I am afraid I don't know what you mean by "rotating an object along a diagonal axis". What you most likely need to do is to concatenate two or more transforms.

See figure 5-8 in Quartz 2D programming Guide The concatenation of two transforms creates the appearance of the image rotating around its lower left corner.

0

精彩评论

暂无评论...
验证码 换一张
取 消