add color_fader
This commit is contained in:
parent
4058b4814d
commit
192e9d22eb
1 changed files with 12 additions and 0 deletions
|
@ -2,6 +2,18 @@ import pygame as pg
|
|||
from abc import abstractmethod
|
||||
|
||||
|
||||
def color_fader(hue=0, increase=1):
|
||||
color = pg.Color(255, 0, 0)
|
||||
h, s, l, a = color.hsla
|
||||
color.hsla = hue, s, l, a
|
||||
|
||||
while True:
|
||||
yield color
|
||||
h, s, l, a = color.hsla
|
||||
h = (h + increase) % 360
|
||||
color.hsla = h, s, l, a
|
||||
|
||||
|
||||
class Effect(pg.sprite.Sprite):
|
||||
def __init__(
|
||||
self, image: pg.Surface, rect: pg.Rect, *groups: pg.sprite.Group
|
||||
|
|
Loading…
Reference in a new issue