pygame精准每像素透明度淡入效果研究

"""
   pygame精准每像素透明度淡入效果研究
"""

__author__ = "李兴球"
__date__ = "2019/8/31"

import pygame

image = pygame.image.load('images/test.png')
screen = pygame.display.set_mode(image.get_size(),0,32)
image = image.convert_alpha()
images = [image.copy() for _ in range(32)]

alphas = [pygame.surfarray.pixels_alpha(image) for image in images]

for index in range(0,32):
    alphas[index][:] = index * 8

You must log in to read the rest of this article. Please log in or register as a user.