# Need Help with Angles

Ok so I need assistance converting absolute transformations to local transformations assuming there’s only a difference of angle on the Z axis. This is for something 2D so normal cframe stuff doesn’t apply here.

For example. Lets say there was a UI element at 0.5,0.5 and I wanted to move it to the right. I would obviously just add to the X position, and then it would be translated right.

The problem is, sometimes this UI has a rotation and I still need it to move to the correct spot. So if it’s rotated 45 degrees, in order to move it right, I need to add half of the movement on the x position, and half on the right.

What is an equation/formula I can use to reconcile the difference in rotation to get the correct translation?

Here’s a chart to help visualize what I mean:

``````deg - 0 = 1x, 0y = rad - 0
deg - 45 = 0.5x, 0.5y = rad - 0.78539816339745
deg - 90 = 0x, 1y = rad - 1.5707963267949
deg - 135 = -0.5x, 0.5y = rad - 2.3561944901923
deg - 180 = -1x, 0y = rad - 3.14
deg - 225 = -0.5x, -0.5y = 3.9269908169872
deg - 270 = 0x, -1y = rad - 4.7123889803847
``````
``````local localTransform = function(pos,angle)