开发者

Why center of RenderTransformOrigin is 0.5,0.5?

开发者 https://www.devze.com 2023-02-15 18:23 出处:网络
When I see samples codes where RenderTransformOrigin is used, they would have 0.5, 0.5 as the center instead of 0,0.

When I see samples codes where RenderTransformOrigin is used, they would have 0.5, 0.5 as the center instead of 0,0.

I tried both and I don't see any differences. Is there a reason why 0.5,0.5开发者_开发知识库 use used as center instead of 0,0?


According to MSDN, the values of RenderTransformOrigin are

values between 0 and 1 [and] are interpreted as a factor for the range of the current element in each x,y axis. For example, (0.5,0.5) will cause the render transform to be centered on the element, or (1,1) would place the render transform at the bottom right corner of the element.

In other words, 0.5,0.5 places the transform origin in the center of the element, and 0,0 places it at the top left corner. If you apply a rotation transform, the result of the former is a rotation about the element's center, and in the the latter case, the rotation is about its top left corner.


(0,0) -> Takes the top left corner.
(0,1) -> Takes the bottom left corner.
(1,1) -> Takes the bottom right corner.
(1,0) -> Takes the top right corner.
(0.5,0.5) -> Takes the mid point.
0

精彩评论

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