[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Rotate an image



Marcos Prieto wrote:
I'm  trying to rotate an image in a pygame app using
pygame.transform.rotate, i know that's normal that the image grown in
each rotation but i dont know how to manage this, How can i get the
original size for the rotated image?
If you are going to be animating a rotation, it is best to always rotate from the original source image. The rotation is a slightly lossy transformation, so if you keep rotating the same image it will get pretty degraded.

Usually when you rotate you want to keep the center point pinned down. I always do this by getting the current center of the image (before rotation). Then after rotating adjusting the position so the center matches.

Check out the pygame Chimp example where this happens when you whack the monkey. Look for the spin method on the actual Chimp class.
http://www.pygame.org/docs/tut/chimp/ChimpLineByLine.html