jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2010
09:53 PM
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?
any suggestions?
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
1 REPLY 1
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2010
10:22 PM
Re: Drawing to Rotating Coordinates...
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:
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
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
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.