particle.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:sappho 作者: lily-mayfield 项目源码 文件源码
def __init__(self, image, origin, tints,
                 blit_flags=0, tint_flags=pygame.BLEND_RGBA_MULT):
        """Initialize the artist.

        Arguments:
            image (pygame.Surface): Image to draw for each particle.
            tints (list of 4-tuple colors): Contains multiple 4-tuples,
                each of which indicates an RGBA tint to apply to the image.
                There should be at least two tints: if two are provided,
                the image will fade from the first tint to the second
                over its lifetime (determined by
                `particle.life / particle.initial_life`).  If more than two
                are given, particle will fade between different tints by
                dividing lifetime equally; so for 4 tints, particle will spend
                1/3 its lifetime between the first two, 1/3 between
                the middle two, and 1/3 between the last two.
            blit_flags (int): special flags determining blit mode (normal,
                additive, subtractive, etc) the tinted image will be applied
                to the surface. By default this is normal -- apply the
                image while respecting alpha, etc.)
            tint_flags (int): special flags determining blit mode (normal,
                additive, subtractive, etc) the tint will be applied to
                the image. By default this is multiplicative.
        """
        self.image = image
        try:
            self.image = self.image.convert_alpha()
        except:  # pragma: no cover
            pass

        if callable(origin):
            self.origin = origin(self.image)
        else:
            self.origin = origin
        self.tints = tints
        self.blit_flags = blit_flags
        self.tint_flags = tint_flags
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号