Let’s assume you wanted to rotate your layer at an angle. Further, let us also assume that you wanted to move that layer in a line along the angle at which the layer was rotated.
The screen being worked in is not usually a 1:1 aspect (that is, the horizontal and vertical axes have different sizes). So, when moving a layer along a line at the rotated angle or along a path perpendicular to that rotation, the trigonometric equation needs to compensate for the screen aspect. To do that, use a calculator or a lookup table to obtain the angle of rotation’s tangent value.
Let’s say the layer has an arbitrary angle of rotation, α, and it needs to move off-screen along a line associated with that angle of rotation.
- Example 1 – Travel along angle of rotation. Assume the layer has an aspect of 1280:720, a zoom = 33%, a starting pan = 0,0 and a rotation angle = 25 degrees. To move the layer off-screen along the 25 degree angle, I want to move the layer to a pan-x = 70. The following equation calculates the required y-axis value (see Figure 1): pan-y=70TAN(25)(16/9) = 58.03.
- Example 2 – Travel perpendicular to angle of rotation. The same information as Example 1 except that the layer needs to move pan-y = -80. The equation to calculate the required x-axis distance (see Figure 1) is pan-x = 80Tan(25)(9/16) = 20.984.You may have to try multiple values for pan along the line of the rotated angle or pan along a line that is perpendicular to the rotated angle to obtain the right distance you need to move layer.
© 20140525-1330 Dale Fenimore, All Rights Reserved