冰墩墩Python代码
import turtle as t
# 设置速度
t.speed(50) # 速度
t.delay(10) # 延迟
t.title('冰墩墩')
# t.bgcolor('red')
# 双耳
# 左耳
t.penup()
t.goto(-150, 200)
t.setheading(160)
t.begin_fill()
t.pendown()
t.circle(-30, 230)
t.setheading(180)
t.circle(37, 90)
t.end_fill()
# 右耳
t.penup()
t.goto(60, 200)
t.setheading(20)
t.begin_fill()
t.pendown()
t.circle(30, 230)
t.setheading(0)
t.circle(-37, 90)
t.end_fill()
# 头
t.pensize(5)
t.penup()
t.goto(-113, 237)
t.setheading(30)
t.pendown()
t.circle(-134, 60)
t.penup()
t.goto(-150, 200)
t.setheading(-120)
t.pendown()
t.circle(200, 80)
t.penup()
t.goto(60, 200)
t.setheading(-60)
t.pendown()
t.circle(-200, 80)
t.penup()
t.setheading(210)
t.pendown()
t.circle(-120, 60)
# 双眼
# 左眼
# 眼圈
t.speed(100)
t.penup()
t.goto(-140, 100)
t.setheading(-45)
t.begin_fill()
t.pendown()
a = 0.2
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.1
t.speed(100)
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.1
t.speed(100)
t.lt(3)
t.fd(a)
t.end_fill()
# 眼白
t.fillcolor("white")
t.penup()
t.goto(-103, 125)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(14, 360)
t.end_fill()
# 眼珠
# t.fillcolor("sienna")
# t.pencolor("sienna")
t.penup()
t.goto(-102, 133)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(6, 360)
t.end_fill()
# 右眼
# 眼圈
t.penup()
t.goto(50, 100)
t.setheading(45)
t.fillcolor("black")
t.pencolor("black")
t.begin_fill()
t.pendown()
a = 0.2
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.1
t.speed(100)
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.1
t.speed(100)
t.lt(3)
t.fd(a)
t.end_fill()
# 眼白
t.fillcolor("white")
t.penup()
t.goto(13, 125)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(14, 360)
t.end_fill()
# 眼珠
# t.fillcolor("sienna")
# t.pencolor("sienna")
t.penup()
t.goto(12, 133)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(6, 360)
t.end_fill()
# 鼻子
t.pencolor("black")
t.fillcolor("black")
t.penup()
t.goto(-55, 133)
t.begin_fill()
t.pendown()
t.fd(20)
t.seth(-120)
t.fd(20)
t.seth(120)
t.fd(20)
t.end_fill()
# 嘴
t.penup()
t.goto(-70, 110)
t.setheading(-30)
t.fillcolor("red")
t.begin_fill()
t.pendown()
t.circle(50, 60)
t.setheading(-120)
t.circle(-100, 15)
t.circle(-15, 90)
t.circle(-100, 15)
t.end_fill()
# 四肢
# 左臂
t.penup()
t.goto(-175, 100)
t.fillcolor("black")
t.begin_fill()
t.setheading(-120)
t.pendown()
t.fd(100)
t.setheading(-110)
t.circle(20, 180)
t.fd(30)
t.circle(-5, 160)
t.end_fill()
# 右臂
t.penup()
t.goto(85, 100)
t.setheading(60)
t.begin_fill()
t.pendown()
t.fd(100)
t.setheading(70)
t.circle(20, 180)
t.fd(30)
t.circle(-5, 160)
t.end_fill()
# 小红心
t.penup()
t.pencolor("red")
t.fillcolor('red')
t.goto(105, 200)
t.begin_fill()
t.pendown()
t.circle(-5, 180)
t.setheading(90)
t.circle(-5, 180)
t.setheading(-120)
t.fd(17)
t.penup()
t.goto(105, 200)
t.pendown()
t.setheading(-60)
t.fd(17)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
# 左腿
t.penup()
t.goto(-120, -45)
t.begin_fill()
t.pendown()
t.setheading(-90)
t.circle(-140, 20)
t.circle(5, 109)
t.fd(30)
t.circle(10, 120)
t.setheading(90)
t.circle(-140, 10)
t.end_fill()
# 右腿
t.penup()
t.goto(30, -45)
t.begin_fill()
t.pendown()
t.setheading(-90)
t.circle(140, 20)
t.circle(-5, 109)
t.fd(30)
t.circle(-10, 120)
t.setheading(90)
t.circle(140, 10)
t.end_fill()
# 冰糖外壳
t.pensize(3)
t.penup()
t.goto(-160, 195)
t.setheading(160)
t.pendown()
t.circle(-40, 230)
t.setheading(30)
t.circle(-134, 58)
t.setheading(60)
t.circle(-40, 215)
t.setheading(-60)
t.fd(15)
t.circle(2, 200)
t.setheading(65)
t.fd(30)
t.circle(-25, 180)
t.fd(100)
t.circle(2, 25)
t.circle(-200, 47)
t.circle(2, 60)
t.circle(140, 23)
t.circle(-2, 90)
t.setheading(180)
t.fd(70)
t.circle(-2, 90)
t.fd(30)
t.setheading(-160)
t.circle(-100, 35)
t.setheading(-90)
t.fd(30)
t.circle(-2, 90)
t.fd(70)
t.circle(-2, 90)
t.setheading(60)
t.circle(140, 30)
t.circle(2, 45)
t.circle(-200, 19)
t.circle(2, 130)
t.fd(30)
t.circle(-25, 180)
t.fd(100)
t.setheading(90)
t.circle(-200, 30)
# 冰糖面罩
t.pensize(3)
t.penup()
t.goto(65, 120)
t.setheading(90)
t.pendown()
t.pencolor("red")
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90: # 控制a的变化
a = a + 0.25
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.25
t.lt(3)
t.fd(a)
t.pencolor("orange")
t.penup()
t.goto(66, 120)
t.pendown()
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.255
t.lt(3)
t.fd(a)
else:
a = a - 0.255
t.lt(3)
t.fd(a)
t.pencolor("green")
t.penup()
t.goto(67, 120)
t.pendown()
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.2555
t.lt(3)
t.fd(a)
else:
a = a - 0.2555
t.lt(3)
t.fd(a)
t.pencolor("deep sky blue")
t.penup()
t.goto(68, 120)
t.pendown()
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.25955
t.lt(3)
t.fd(a)
else:
a = a - 0.25955
t.lt(3)
t.fd(a)
t.pencolor("pink")
t.penup()
t.goto(71, 120)
t.pendown()
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.26
t.lt(3)
t.fd(a)
else:
a = a - 0.26
t.lt(3)
t.fd(a)
t.pencolor("purple")
t.penup()
t.goto(72, 120)
t.pendown()
a = 1
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.269
t.lt(3)
t.fd(a)
else:
a = a - 0.269
t.lt(3)
t.fd(a)
# 五环
t.penup()
t.goto(-55, -10)
t.pendown()
t.pencolor("blue")
t.circle(10)
t.penup()
t.goto(-40, -10)
t.pendown()
t.pencolor("black")
t.circle(10)
t.penup()
t.goto(-25, -10)
t.pendown()
t.pencolor("red")
t.circle(10)
t.penup()
t.goto(-50, -20)
t.pendown()
t.pencolor("yellow")
t.circle(10)
t.penup()
t.goto(-30, -20)
t.pendown()
t.pencolor("green")
t.circle(10)
# 输出文字
printer = t.Turtle()
printer.hideturtle()
printer.penup()
printer.goto(-350,-50)
printer.write("可",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-100)
printer.write("爱",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-150)
printer.write("冰",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-200)
printer.write("墩",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-250)
printer.write("墩",move = True, align="left", font=('宋体',40,'normal'))
t.hideturtle()
t.done()
免责声明:本文由用户上传,与本网站立场无关。财经信息仅供读者参考,并不构成投资建议。投资者据此操作,风险自担。 如有侵权请联系删除!
-
大众CC作为一款备受关注的中型轿车,凭借其优雅的设计和出色的性能一直吸引着众多消费者的目光。2025款大众CC...浏览全文>>
-
2025款阜阳途锐新车正式上市,凭借其卓越的性能和豪华配置吸引了众多消费者的关注。这款车型以最低售价55 88...浏览全文>>
-
在准备购买一辆汽车之前,了解车辆的落地价格是非常重要的。所谓落地价,是指购车时除了车款之外还需要支付的...浏览全文>>
-
安徽淮南地区的长安启源E07作为一款备受关注的新能源车型,凭借其时尚的设计、丰富的配置以及出色的续航能力,...浏览全文>>
-
安徽淮南长安启源A05 2025款新车现已正式上市,这款车型以其高性价比和出色性能吸引了众多消费者的关注。作为...浏览全文>>
-
安徽阜阳地区的威然车型在近期进行了配置上的升级,对于想要购买这款MPV的消费者来说,这是一个值得关注的消息...浏览全文>>
-
随着汽车市场的不断发展,SUV车型因其宽敞的空间和多功能性受到了越来越多消费者的青睐。作为大众旗下的高端旗...浏览全文>>
-
安徽蚌埠地区想要购买长安启源E07这款新能源汽车的朋友,可以参考以下信息来做出更明智的选择。长安启源E07定...浏览全文>>
-
随着汽车市场的不断发展,2025款安庆高尔夫作为一款备受关注的车型,其价格和配置自然成为消费者热议的话题。...浏览全文>>
-
近期,安徽蚌埠地区的帕萨特车型迎来了新一轮的价格调整,其落地价再次创下新低,吸引了众多消费者的关注。作...浏览全文>>
- 悉尼最后几个年薪低于 10 万美元的郊区
- 2025 年新南威尔士州值得投资的地方
- 揭秘在澳大利亚买房需要多少收入
- 悉尼最后几个年薪低于 10 万美元的郊区
- 昆士兰有望成为澳大利亚房地产强国之一
- MSI 推出首款双模式 4K 曲面电竞显示器
- 飞利浦 Screeneo GamePix 900:在发布前进行预览
- 您会在这个奇怪的电动露营三轮车里露营吗
- Meross 推出支持 Matter 的智能恒温器
- 配备出色 3K OLED 显示屏的 Acer Swift 16 现已降价至史上最低价
- Acer Predator Helios 18 RTX 4080 游戏笔记本电脑 现优惠 725 美元
- VivoX200Pro视频和新样张揭示了200MP蔡司变焦相机的锐利眼睛可以达到多远
- 派对氛围天文爱好者又一次欣赏到极光秀
- iPhone16相机控制按钮有史以来最不苹果的东西
- 贾雷尔夸萨与利物浦签订新合同
- 首款在安兔兔上得分300万的手机拥有非常强大的SoC即将发布
- HumaninMotionRobotics的自平衡XoMotion外骨骼获得加拿大批准用于物理治疗
- 龙宫样本对之前关于富碳小行星形成的观点提出了质疑
- 凯文德布劳内伤情更新曼城球星的伤势进展和可能的回归日期
- 实验室实验表明用核武器轰炸一颗巨大的小行星可以拯救地球