Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why center of RenderTransformOrigin is 0.5,0.5?

Tags:

c#

wpf

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?

like image 656
KMC Avatar asked Mar 10 '11 03:03

KMC


1 Answers

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.

like image 86
Ben M Avatar answered Oct 08 '22 17:10

Ben M