首页 > 分享 > 模拟3D星空

模拟3D星空

最新推荐文章于 2024-11-28 22:30:12 发布

李兴球 于 2018-07-20 08:17:14 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

"""
 模拟3D星空-海龟画图版-星星从右边出来.

"""
from turtle import *
from random import random,randint

screen = Screen()
width ,height = 800,600
screen.setup(width,height)
screen.title("模拟3D星空_海龟画图版_作者:李兴球")
screen.bgcolor("black")
screen.mode("logo")
screen.delay(0)                 #这里要设为0,否则很卡

t = Turtle(visible = False,shape='circle')
t.pencolor("white")
t.fillcolor("white")
t.penup()
t.setheading(-90)
t.goto(width/2,randint(-height/2,height/2))

stars = []
for i in range(200):
    star = t.clone()
    s =random() /3    
    star.shapesize(s,s)
    star.speed(int(s*10))
    star.setx(width/2 + randint(1,width))
    star.sety( randint(-height/2,height/2))
    star.showturtle()
    stars.append(star)

   
while True:
    for star in stars:
        star.setx(star.xcor() - 3 * star.speed())
        if star.xcor()<-width/2:
            star.hideturtle()
            star.setx(width/2 + randint(1,width))
            star.sety( randint(-height/2,height/2))
            star.showturtle()
 原创文章/代码:转载请注明出处。

相关知识

《520七夕情人节表白礼物》❤520表白星空漫漫3D相册❤(HTML+CSS+JavaScript)
HTML浪漫动态表白代码绚烂星空烟花+粉色大爱心+3D大小魔方旋转相册+音乐(附源码)(三)
炫酷3D相册❤ 520七夕情人节表白网页制作❤(HTML+CSS+JavaScript)
模拟开花店的游戏
《模拟人生3》浪漫满屋 40*40 经济实用
幻想星空灿烂各种水晶花朵晶莹剔透AI绘画图片
园艺3d模型图片
花草3d模型图片
3D免抠元素
佑途C2M记录仪体验:4K高清录制+3D辅助驾驶=

网址: 模拟3D星空 https://m.huajiangbk.com/newsview1496829.html

所属分类:花卉
上一篇: MATLAB 制作抖音同款旋转星
下一篇: 19朵香槟玫瑰5朵向日葵,你这般