diff --git a/effects/effect.py b/effects/effect.py index 1c25936..889f598 100644 --- a/effects/effect.py +++ b/effects/effect.py @@ -1,7 +1,7 @@ from dataclasses import dataclass import math import random -from typing import Generator, Tuple +from typing import Generator, Literal, Tuple import pygame as pg @@ -42,6 +42,23 @@ def color_randomize() -> Generator[pg.Color, None, None]: color.hsla = random.randint(0, 359), s, l, a +def rainbow_surface( + image: pg.Surface, + orientation: Literal["h", "v"] = "h", + hue: int = 0, + increase: int = 1, +): + wheel = color_wheel(hue, increase) + if orientation == "h": + h = image.get_height() + for x in range(image.get_width()): + pg.draw.line(image, next(wheel), (x, 0), (x, h)) + elif orientation == "v": + w = image.get_width() + for y in range(image.get_height()): + pg.draw.line(image, next(wheel), (0, y), (w, y)) + + def transform_bounce( bounds: pg.Rect, velocity: Tuple[int, int],