赞
踩
def __init__(self, generate_frame=20):
# 原始爱心坐标集合
self._points = set()
# 边缘扩散效果点坐标集合
self._edge_diffusion_points = set()
# 中心扩散效果点坐标集合
self._center_diffusion_points = set()
# 每帧动态点坐标
self.all_points = {}
self.build(2000)
self.random_halo = 1000
self.generate_frame = generate_frame
for frame in range(generate_frame):
self.calc(frame)
def build(self, number):
for _ in range(number):
t = random.uniform(0, 2 * pi)
x, y = heart(t)
self._points.add((x, y))
# 爱心内扩散
for _x, _y in list(self._points):
for _ in range(3):
x, y = scatter_inside(_x, _y, 0.05)
self._edge_diffusion_points.add((x, y))
# 爱心内再次扩散
point_list = list(self._points)
for _ in range(4000):
x, y = random.choice(point_list)
x, y = scatter_inside(x, y, 0.17)
self._center_diffusion_poi
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。