用户:
机智的多林查看:2 回复:1 评论:2 创建时间:2022-02-16T01:59:08
我之前看到许多用代码写出来的冰墩墩,发现冰墩墩都是一样的。我当时就想:冬天里面每一篇雪花都不一样,那为什写出来的代码要一样,画出来的冰墩墩也要一样呢!经过几天的研究(其实代码早些好),我写出来一个不一样的冰墩墩代码,下面就分享一下我的成果吧!!!
大家的冰墩墩展示!!!
我的冰墩墩展示!!!
我的冰墩墩代码展示!!!
import turtle
import time
import turtle as t
# t.screensize(1500,1500,'white')
t.speed(0)
t.pensize(5)
t.color('black')
t.hideturtle()
t.delay(0)
# ear right
t.penup()
t.goto(42.25, 100.5)
t.pendown()
t.fillcolor('black')
t.begin_fill()
t.setheading(75)
t.circle((-15), 100)
t.circle((-30), 86)
t.end_fill()
# ear right
t.penup()
t.goto((-42.25), 100.5)
t.pendown()
t.begin_fill()
t.setheading(105)
t.circle(15, 100)
t.circle(30, 86)
t.end_fill()
# body shape right
t.penup()
t.goto(0, 110)
t.setheading(0)
t.pendown()
t.circle((-100), 85)
t.circle((-195), 35)
t.right(5)
t.circle((-12.5), 30)
t.circle((-150), 30)
# body shape left
t.penup()
t.goto(0, 110)
t.pendown()
t.setheading(180)
t.circle(100, 85)
t.circle(195, 35)
t.left(5)
t.circle(12.5, 30)
t.circle(150, 30)
# right hand
t.pensize(2.5)
t.penup()
t.goto(100, (-5))
t.pendown()
t.setheading(60)
t.fillcolor('black')
t.begin_fill()
t.forward(20)
t.circle((-15), 140)
t.circle((-27.5), 30)
t.circle((-32.5), 78)
t.end_fill()
# little red heart
t.pensize(1)
t.color('red')
t.fillcolor('red')
t.penup()
t.goto(122.5, 7.5)
t.pendown()
t.setheading(120)
t.begin_fill()
t.forward(3.5)
t.circle(2.5, 160)
t.right(10)
t.circle(7.5, 60)
t.forward(3.6)
t.setheading(35)
t.forward(5)
t.circle(7.5, 40)
t.circle(2.5, 180)
t.right(30)
t.forward(3.5)
t.end_fill()
# left hand
t.color('black')
t.fillcolor('black')
t.pensize(2.5)
t.penup()
t.goto((-101), (-22.5))
t.begin_fill()
t.setheading((-125))
t.pendown()
t.forward(35)
t.circle(15, 160)
t.circle(12.5, 40)
t.circle(25, 25)
t.end_fill()
# right foot
t.fillcolor('black')
t.penup()
t.goto(32.5, (-112.5))
t.begin_fill()
t.setheading((-90))
t.pendown()
t.forward(15)
t.circle((-20), 32)
t.circle(3.5, 110)
t.circle(30, 10)
t.circle(50, 5)
t.forward(24)
t.circle(7.5, 90)
t.forward(39)
t.setheading((-158))
t.forward(40)
t.end_fill()
# left foot
t.fillcolor('black')
t.penup()
t.goto((-32.5), (-112.5))
t.begin_fill()
t.setheading((-90))
t.pendown()
t.forward(15)
t.circle(20, 32)
t.circle((-3.5), 110)
t.circle((-30), 10)
t.circle((-50), 5)
t.forward(24)
t.circle((-7.5), 90)
t.forward(39)
t.setheading((-22))
t.forward(40)
t.end_fill()
# circles
# blue right
t.color('#喵95ED')
t.pensize(2.5)
t.penup()
t.setheading(0)
t.goto(0, 70)
t.pendown()
t.circle((-105), 15)
t.circle((-80), 20)
t.circle((-60), 80)
t.circle((-15), 40)
t.circle((-140), 30)
# blue left
t.penup()
t.setheading(180)
t.goto(0, 70)
t.pendown()
t.circle(105, 15)
t.circle(80, 20)
t.circle(60, 80)
t.circle(15, 40)
t.circle(140, 30)
# red right
t.color('#b22222')
t.pensize(2.5)
t.penup()
t.setheading(0)
t.goto(0, 72.5)
t.pendown()
t.circle((-107.5), 15)
t.circle((-82.5), 20)
t.circle((-62.5), 80)
t.circle((-17.5), 40)
t.circle((-142.5), 30)
# red left
t.penup()
t.setheading(180)
t.goto(0, 72.5)
t.pendown()
t.circle(107.5, 15)
t.circle(82.5, 20)
t.circle(62.5, 80)
t.circle(17.5, 40)
t.circle(142.5, 30)
# purple right
t.color('#9A32CD')
t.pensize(2.5)
t.penup()
t.setheading(0)
t.goto(0, 75)
t.pendown()
t.circle((-110), 15)
t.circle((-85), 20)
t.circle((-65), 80)
t.circle((-20), 40)
t.circle((-145), 30)
# purple left
t.penup()
t.setheading(180)
t.goto(0, 75)
t.pendown()
t.circle(110, 15)
t.circle(85, 20)
t.circle(65, 80)
t.circle(20, 40)
t.circle(145, 30)
# yellow right
t.color('#b8860b')
t.pensize(2.5)
t.penup()
t.setheading(0)
t.goto(0, 77.5)
t.pendown()
t.circle((-112.5), 15)
t.circle((-87.5), 20)
t.circle((-67.5), 80)
t.circle((-22.5), 40)
t.circle((-147.5), 30)
# yellow left
t.penup()
t.setheading(180)
t.goto(0, 77.5)
t.pendown()
t.circle(112.5, 15)
t.circle(87.5, 20)
t.circle(67.5, 80)
t.circle(22.5, 40)
t.circle(147.5, 30)
# green right
t.color('#00CD00')
t.pensize(2.5)
t.penup()
t.setheading(0)
t.goto(0, 80)
t.pendown()
t.circle((-115), 15)
t.circle((-90), 20)
t.circle((-70), 80)
t.circle((-25), 40)
t.circle((-150), 30)
# green left
t.penup()
t.setheading(180)
t.goto(0, 80)
t.pendown()
t.circle(115, 15)
t.circle(90, 20)
t.circle(70, 80)
t.circle(25, 40)
t.circle(150, 30)
# black eye shade right
t.color('black')
t.fillcolor('black')
t.penup()
t.goto(20, 40)
t.pendown()
t.setheading(70)
t.begin_fill()
t.circle((-7.5), 40)
t.circle((-12.5), 20)
t.circle((-29), 100)
t.circle((-12.5), 20)
t.circle((-10), 60)
t.circle((-29), 100)
t.circle((-12.5), 20)
t.circle((-7.5), 40)
t.end_fill()
# black eye shade left
t.color('black')
t.fillcolor('black')
t.penup()
t.goto((-20), 40)
t.pendown()
t.setheading(110)
t.begin_fill()
t.circle(7.5, 40)
t.circle(12.5, 20)
t.circle(29, 100)
t.circle(12.5, 20)
t.circle(10, 60)
t.circle(29, 100)
t.circle(12.5, 20)
t.circle(7.5, 40)
t.end_fill()
# white circle part right
t.color('white')
t.penup()
t.setheading(0)
t.goto(36, 38)
t.pendown()
t.circle((-10), 360)
t.penup()
t.goto(39, 30.5)
t.pendown()
t.circle(1, 360)
# white circle part left
t.color('white')
t.penup()
t.goto((-36), 38)
t.pendown()
t.circle((-10), 360)
t.penup()
t.goto((-33), 30.5)
t.pendown()
t.circle(1, 360)
# black nose
t.color('black')
t.fillcolor('black')
t.penup()
t.setheading(0)
t.goto((-2.5), 22.5)
t.pendown()
t.begin_fill()
t.forward(7.5)
t.circle((-2.5), 120)
t.circle((-15), 30)
t.setheading(150)
t.circle((-15), 30)
t.circle((-2.5), 120)
t.end_fill()
# mouth
t.color('black')
t.fillcolor('black')
t.penup()
t.goto(0, 5)
t.pendown()
t.begin_fill()
t.circle(25, 40)
t.setheading(150)
t.forward(2.5)
t.right(180)
t.circle((-20), 50)
t.circle((-10), 50)
t.circle((-22.5), 30)
t.circle((-20), 80)
t.circle((-22.5), 20)
t.circle((-10), 30)
t.forward(3.5)
t.setheading((-35))
t.circle(15, 45)
t.end_fill()
# tongue
t.color('red')
t.fillcolor('red')
t.penup()
t.goto((-9), (-10))
t.pendown()
t.setheading(60)
t.begin_fill()
t.circle((-15), 135)
t.setheading((-147))
t.circle((-22.5), 30)
t.circle((-20), 45)
t.end_fill()
# outline right
t.color('black')
t.pensize(1.5)
t.setheading(0)
t.penup()
t.goto(0, 117.5)
t.pendown()
t.circle((-102.5), 23)
t.setheading(75)
t.circle((-17.5), 105)
t.circle((-40), 75)
t.setheading((-55))
t.circle((-150), 24)
t.setheading(60)
t.circle((-17.5), 140)
t.circle((-40), 55)
t.circle((-55), 32)
t.setheading((-100))
t.circle((-160), 24)
t.setheading((-90))
t.forward(40)
t.circle((-7.5), 87)
t.forward(35)
t.circle((-50), 5)
t.circle((-30), 10)
t.circle((-3.5), 95)
t.circle(30, 15)
t.setheading(75)
t.forward(12)
t.setheading(90)
t.circle(5, 90)
t.forward(27)
# outline left
t.color('black')
t.pensize(1.5)
t.setheading(180)
t.penup()
t.goto(0, 117.5)
t.pendown()
t.circle(102.5, 23)
t.setheading(105)
t.circle(17.5, 105)
t.circle(40, 75)
t.setheading((-125))
t.circle(140, 42)
t.setheading((-125))
t.forward(32.5)
t.circle(20, 160)
t.circle(15, 40)
t.setheading((-70))
t.circle(140, 14)
t.setheading((-90))
t.forward(40)
t.circle(7.5, 87)
t.forward(35)
t.circle(50, 5)
t.circle(30, 10)
t.circle(3.5, 95)
t.circle((-30), 15)
t.setheading(90)
t.forward(12)
t.setheading(90)
t.circle((-5), 90)
t.forward(27)
PS:注意此代码需要用海龟编辑器打开