python烟花代码 | 您所在的位置:网站首页 › python烟花代码可复制 › python烟花代码 |
如下 # -*- coding: utf-8 -*- import math, random,time import threading import tkinter as tk import re #import uuid Fireworks=[] maxFireworks=8 height,width=600,600 class firework(object): def __init__(self,color,speed,width,height): #uid=uuid.uuid1() self.radius=random.randint(2,4) #粒子半径为2~4像素 self.color=color #粒子颜色 self.speed=speed #speed是1.5-3.5秒 self.status=0 #在烟花未爆炸的情况下,status=0;爆炸后,status>=1;当status>100时,烟花的生命期终止 self.nParticle=random.randint(20,30) #粒子数量 self.center=[random.randint(0,width-1),random.randint(0,height-1)] #烟花随机中心坐标 self.oneParticle=[] #原始粒子坐标(100%状态 |
CopyRight 2018-2019 实验室设备网 版权所有 |