-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpansion 2.py
62 lines (46 loc) · 1.52 KB
/
expansion 2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import pmma
import time
import pygame
import traceback
pmma.init(log_information=True)
noise = pmma.Perlin()
r_noise = pmma.Perlin()
g_noise = pmma.Perlin()
b_noise = pmma.Perlin()
display = pmma.Display()
display.create(fullscreen=False, resizable=True)
events = pmma.Events()
draw = pmma.Draw()
backpack = pmma.Backpack
math = pmma.Math()
scale = 4
class Circle:
def __init__(self, x, y, radius, color):
self.x = x
self.y = y
self.radius = radius
self.color = color
def render(self):
draw.circle(self.color, (self.x, self.y), self.radius)
self.radius += 10/scale
render_pipeline = []
start = time.perf_counter()
now_time = 0
while backpack.running:
#print(display.get_fps())
display.clear(pygame.transform.average_color(display.pygame_surface.pygame_surface))
events.handle()
col = [r_noise.generate_1D_perlin_noise(now_time/7, new_range=[0, 255]),
g_noise.generate_1D_perlin_noise(now_time/7, new_range=[0, 255]),
b_noise.generate_1D_perlin_noise(now_time/7, new_range=[0, 255])]
c = Circle(display.get_width() // 2, noise.generate_1D_perlin_noise(now_time/4, new_range=[50, display.get_height()-50]), 100, col)
render_pipeline.append(c)
copy = render_pipeline.copy()
for element in copy:
element.render()
if element.radius > display.get_width():
render_pipeline.remove(element)
pmma.compute()
display.refresh(refresh_rate=75) # 7
now_time = (time.perf_counter() - start)/scale
pmma.quit()