From bdac228f28c117ff0070e257aca07b88acdcca73 Mon Sep 17 00:00:00 2001 From: pw4e8vz7f <2907813330@qq.com> Date: Thu, 10 Mar 2022 11:28:09 +0800 Subject: [PATCH] ADD file via upload --- 星阵2.py | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 星阵2.py diff --git a/星阵2.py b/星阵2.py new file mode 100644 index 0000000..a615676 --- /dev/null +++ b/星阵2.py @@ -0,0 +1,130 @@ +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()