52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
from pygame.locals import *
|
|
import math
|
|
import pygame as pg
|
|
import random
|
|
import sys
|
|
import time
|
|
|
|
from effects.bouncingspot import BouncingSpot
|
|
from effects.effect import color_wheel
|
|
|
|
# pg.init()
|
|
|
|
win = pg.display.set_mode(size=(800, 600), flags=pg.RESIZABLE)
|
|
|
|
# background = pg.Surface(win.get_size())
|
|
# background.fill(pg.Color(0, 0, 0))
|
|
|
|
background = pg.Surface(win.get_size(), flags=pg.SRCALPHA)
|
|
background.fill(pg.Color(0, 0, 0, 10))
|
|
|
|
|
|
effects = [
|
|
BouncingSpot(
|
|
bounds=win.get_rect(),
|
|
color=pg.Color(255, 255, 255),
|
|
# color=color_wheel(),
|
|
sizes=(300, 300),
|
|
velocity=(1, 1),
|
|
x_factor=(1, 1),
|
|
y_factor=(2.2, 2.2),
|
|
),
|
|
BouncingSpot(bounds=win.get_rect(), color=color_wheel()),
|
|
BouncingSpot(bounds=win.get_rect(), color=color_wheel(hue=180)),
|
|
]
|
|
|
|
|
|
FPS = pg.time.Clock()
|
|
|
|
while True:
|
|
for event in pg.event.get():
|
|
if event.type == QUIT:
|
|
pg.quit()
|
|
sys.exit()
|
|
|
|
win.blit(background, (0, 0))
|
|
for e in effects:
|
|
e.update()
|
|
e.draw(win)
|
|
|
|
pg.display.flip()
|
|
FPS.tick(60)
|
|
# print(FPS.get_fps())
|