用户:SCPStqy查看:0 回复:0 评论:0 创建时间:2021-01-10T13:15:40
【作品展示】

【作品介绍】
宇宙的诞生
【作品源代码】
#为了效果更好,请点击最大化
#为了效果更好,请播放《cornfield chase》—— Hans Zimmer
import turtle
import random
import time
#宇宙大爆炸
ms = turtle.Screen()
ms.setup(1000,600)
turtle.bgcolor('black')
Birth = turtle.Pen()
Birth.hideturtle()
Birth.dot(5,'white')
time.sleep(5)
l = 5
for i in range(150):
Birth.pencolor('yellow')
Birth.dot(l)
l += 10
time.sleep(5)
a = 5
for i in range(150):
Birth.speed(0)
Birth.pencolor('white')
Birth.dot(a)
a += 10
b = 5
for i in range(150):
Birth.pencolor('black')
Birth.dot(b)
b += 10
#恒星的诞生
Stars = turtle.Pen()
Stars.hideturtle()
Stars.speed(0)
colors_list = ['white', 'snow', 'ghostwhite', 'white喵oke', 'blue', 'yellow', 'red']
while True:
Stars.penup()
Stars.pencolor(random.choice(colors_list))
x = random.randint((-1000), 1000)
y = random.randint((-1000), 1000)
Stars.goto(x, y)
Stars.pendown()
Stars.dot(random.randint(1, 5))
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn