我是说,在Python中。透明度。我只想一个图像出现,然后慢慢消失,也就是说,变得透明。在
我的实际代码。在
def post_texto_1():
inicio = True
alpha = 255
screen.fill((0, 0, 0))
while inicio:
for event in pygame.event.get():
if event.type == QUIT:
exit()
imagen_postTexto1.set_alpha(alpha)
screen.blit(imagen_postTexto1, (0, 0))
alpha -= 1
if alpha == 0:
inicio = False
tex2 = u"¿Dónde estoy? ¿A dónde voy?"
mostrar_mensaje(tex2, (255, 255, 255))
print("El alpha de la imagen es : "+str(alpha))
pygame.display.update()
使用^{} 时,更改图像的像素格式,包括每像素字母。在
根据^{} 的PyGame文档,如果表面格式(即图像)包含每像素alphas,alpha值将被忽略。在
如果您仍然需要显示透明图像并希望使用} 方法设置一个颜色透明。在
set_alpha()
,可以使用PyGames^{使用以下函数可使图像消失:
相关问题 更多 >
编程相关推荐