You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
2.2 KiB
131 lines
2.2 KiB
import turtle as t
|
|
import time, random
|
|
|
|
|
|
# 六芒星
|
|
def LMX(x, y, d):
|
|
t.penup()
|
|
t.goto(x, y)
|
|
t.pendown()
|
|
t.seth(60)
|
|
for i in range(3):
|
|
t.fd(d)
|
|
t.left(120)
|
|
t.penup()
|
|
t.goto(x, -y)
|
|
t.pendown()
|
|
t.seth(-60)
|
|
for i in range(3):
|
|
t.fd(d)
|
|
t.right(120)
|
|
t.hideturtle()
|
|
|
|
|
|
# 圆
|
|
def yuan(r):
|
|
t.penup()
|
|
t.goto(-r * pow(3, 0.5) / 2, -r / 2)
|
|
t.pendown()
|
|
t.circle(r)
|
|
t.hideturtle()
|
|
|
|
|
|
# 六个小圆环
|
|
def sixy(x, y, r):
|
|
def txyuan(x, y, r):
|
|
t.seth(0)
|
|
y = y - r
|
|
t.penup()
|
|
t.goto(x, y)
|
|
t.pendown()
|
|
t.pensize(2)
|
|
t.circle(r)
|
|
t.penup()
|
|
t.goto(x, y + 3)
|
|
t.pendown()
|
|
r = r - 3
|
|
y = y - r
|
|
t.circle(r)
|
|
|
|
t.color("#5daed9")
|
|
txyuan(x, y, r)
|
|
txyuan(-x, y, r)
|
|
txyuan(-x, -y, r)
|
|
txyuan(x, -y, r)
|
|
txyuan(175, 0, r)
|
|
txyuan(-175, 0, r)
|
|
t.hideturtle()
|
|
|
|
|
|
# 六边形
|
|
|
|
def lbx(x, y):
|
|
t.penup()
|
|
t.goto(x, y)
|
|
t.pendown()
|
|
for i in range(6):
|
|
t.fd(180)
|
|
t.left(60)
|
|
t.hideturtle()
|
|
|
|
|
|
|
|
|
|
# 初始化
|
|
|
|
|
|
t.setup(1.0, 1.0, 0, 0)
|
|
t.bgcolor("black")
|
|
t.pencolor("#7ecff1")
|
|
t.hideturtle()
|
|
|
|
# 六芒星和叠加
|
|
mt = ["#0489D4", "#d9f1f1"] # 蓝色,,浅蓝
|
|
mv = ["#6cd1ef", "#d9f1f1"]
|
|
for i in range(2):
|
|
t.speed(3)
|
|
t.delay(0)
|
|
t.pensize(2 - i * 1.2)
|
|
t.color(mt[i])
|
|
LMX(0, -70, 122.5)
|
|
LMX(0, -100, 175)
|
|
t.pensize(3 - i * 1.6)
|
|
t.color(mv[i])
|
|
LMX(0, -200, 350)
|
|
LMX(0, -220, 385)
|
|
|
|
# 圆叠加
|
|
nc = ["#94d5f0", "#acdefa"]
|
|
for i in range(2):
|
|
t.speed(13)
|
|
t.pensize(3 - i * 1.5)
|
|
t.pencolor(nc[i])
|
|
yuan(220 + i)
|
|
yuan(250 + i)
|
|
yuan(258 + i)
|
|
t.pensize(1)
|
|
t.pencolor("#389bc8")
|
|
t.speed(6)
|
|
yuan(100 + i)
|
|
yuan(110 + i)
|
|
yuan(35 + i)
|
|
yuan(30 + i)
|
|
|
|
# 六个小圆环
|
|
time.sleep(0.5)
|
|
t.speed(5)
|
|
sixy(86, 155, 40)
|
|
|
|
# 六边形和叠加效果
|
|
BT = ["#54B6D8", "#f0efeb"]
|
|
t.speed(10)
|
|
for i in range(2):
|
|
t.speed(5)
|
|
t.delay(0)
|
|
t.color(BT[i])
|
|
t.pensize(3 - i * 1.6)
|
|
t.seth(-12)
|
|
|
|
|
|
t.done()
|