2024-04-19 09:01:20 发布
网友
我已经用函数pygame.transform.rotate()、_get_rect()、_get_rect().center和_get_size()玩了一段时间了。
pygame.transform.rotate()
_get_rect()
_get_rect().center
_get_size()
我有一个箭头的图像,我想旋转,我有困难,以了解发生了什么。
我的问题是从哪个点开始旋转?
在我的例子中,我有一个28x182大小的图像,我用screen.blit()将其放在200100。
screen.blit()
原始文档似乎没有指定问题的答案。
未经过滤的逆时针旋转。角度参数表示度数,可以是任何浮点值。负角度量将顺时针旋转。
除非以90度增量旋转,否则图像将被填充得更大以保持新的大小。如果图像有像素字母,填充区域将是透明的。否则pygame将选择与Surface colorkey或左上角像素值匹配的颜色。
可以使用示例here旋转,同时保持图像的中心:
def rot_center(image, rect, angle): """rotate an image while keeping its center""" rot_image = pygame.transform.rotate(image, angle) rot_rect = rot_image.get_rect(center=rect.center) return rot_image,rot_rect
我似乎找不到旋转中心pygame实际使用的是,bar a referencehere:
pygame
it doesn't rotate about the origin, or any particular point for that matter: the fixed point of rotation depends on the surface dimensions and the rotation angle
原始文档似乎没有指定问题的答案。
未经过滤的逆时针旋转。角度参数表示度数,可以是任何浮点值。负角度量将顺时针旋转。
除非以90度增量旋转,否则图像将被填充得更大以保持新的大小。如果图像有像素字母,填充区域将是透明的。否则pygame将选择与Surface colorkey或左上角像素值匹配的颜色。
可以使用示例here旋转,同时保持图像的中心:
我似乎找不到旋转中心
pygame
实际使用的是,bar a referencehere:相关问题 更多 >
编程相关推荐