Drawing to Rotating Coordinates...

If I am drawing to the center of the screen, say 640/360 and I rotate the coordinate system by 1 degree, it appears that the axis of rotation is 0,0. Does anyone know what mathematical calculation would allow me to keep an object in the center of the screen while rotating the coordinate system? clearly x and y have to change in order for the object to stay in its exact location, since the location of 640,360 has now changed… but what might the formula be? I’m pretty sure it would be some trigonometry, but not sure what.

any suggestions?

You have to use TargetTranslation to move the origin to 640,360. This still won’t do what you want if you want to rotate the object around its midpoint. If that’s what you want, you have to set the TargetRect values to minus half the width and height. For example, the screensaver for Video Poker rotates the cards like this:


item = [{ url:url,TargetRect:{x:Int(-cardw/2), y:Int(-cardh/2), w:cardw, h:cardh},TargetRotation:r,TargetTranslation:{x:x,y:y}}]
canvas.SetLayer(1,item)

r, x, and y are random

By the way, if you’re rotating a square and the corners are no longer 90 degrees, it’s you display that’s the problem. Also, it’s hard to make a square maintain it’s aspect ratio on an SD screen since everything has to be stretched slightly horizontally to maintain aspect ratio. On an HD screen, a square should always be a square.

-JT