python(3)---turtle实例

  今天学了一下python里面的海龟库,跟着视频画了一条python的图标,本来想着自己画一下玫瑰花等其他图形来锻炼一下

自己,后来到网上一看,有许多大神已经做了类似的工作,我挑选了一些比较好的,放在了博客园中,我也会注明出处:

  https://blog.csdn.net/weixin_43943977/article/details/102731555

       https://blog.csdn.net/weixin_43943977/article/details/102691392

在此感谢网络大神的贡献。

  代码如下:

 1 import turtle as T
 2 import random
 3 import time
 4 
 5 # 画樱花的躯干(60,t)
 6 def Tree(branch, t):
 7     time.sleep(0.0005)
 8     if branch > 3:
 9         if 8 <= branch <= 12:
10             if random.randint(0, 2) == 0:
11                 t.color('snow')  #
12             else:
13                 t.color('lightcoral')  # 淡珊瑚色
14             t.pensize(branch / 3)
15         elif branch < 8:
16             if random.randint(0, 1) == 0:
17                 t.color('snow')
18             else:
19                 t.color('lightcoral')  # 淡珊瑚色
20             t.pensize(branch / 2)
21         else:
22             t.color('sienna')  # 赭(zhě)色
23             t.pensize(branch / 10)  # 6
24         t.forward(branch)
25         a = 1.5 * random.random()
26         t.right(20 * a)
27         b = 1.5 * random.random()
28         Tree(branch - 10 * b, t)
29         t.left(40 * a)
30         Tree(branch - 10 * b, t)
31         t.right(20 * a)
32         t.up()
33         t.backward(branch)
34         t.down()
35 
36 # 掉落的花瓣
37 def Petal(m, t):
38     for i in range(m):
39         a = 200 - 400 * random.random()
40         b = 10 - 20 * random.random()
41         t.up()
42         t.forward(b)
43         t.left(90)
44         t.forward(a)
45         t.down()
46         t.color('lightcoral')  # 淡珊瑚色
47         t.circle(1)
48         t.up()
49         t.backward(a)
50         t.right(90)
51         t.backward(b)
52 
53 # 绘图区域
54 t = T.Turtle()
55 # 画布大小
56 w = T.Screen()
57 t.hideturtle()  # 隐藏画笔
58 t.getscreen().tracer(5, 0)
59 w.screensize(bg='wheat')  # wheat小麦
60 t.left(90)
61 t.up()
62 t.backward(150)
63 t.down()
64 t.color('sienna')
65 
66 # 画樱花的躯干
67 Tree(60, t)
68 # 掉落的花瓣
69 Petal(200, t)
70 w.exitonclick()
cherry
 1 from turtle import *
 2 from random import *
 3 from math import *
 4 
 5 def tree(n,l):
 6     pd()#下笔
 7     #阴影效果
 8     t = cos(radians(heading()+45))/8+0.25
 9     pencolor(t,t,t)
10     pensize(n/3)
11     forward(l)#画树枝
12 
13     if n>0:
14         b = random()*15+10 #右分支偏转角度
15         c = random()*15+10 #左分支偏转角度
16         d = l*(random()*0.25+0.7) #下一个分支的长度
17         #右转一定角度,画右分支
18         right(b)
19         tree(n-1,d)
20         #左转一定角度,画左分支
21         left(b+c)
22         tree(n-1,d)
23         #转回来
24         right(c)
25     else:
26         #画叶子
27         right(90)
28         n=cos(radians(heading()-45))/4+0.5
29         pencolor(n,n*0.8,n*0.8)
30         circle(3)
31         left(90)
32         #添加0.3倍的飘落叶子
33         if(random()>0.7):
34             pu()
35             #飘落
36             t = heading()
37             an = -40 +random()*40
38             setheading(an)
39             dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)
40             forward(dis)
41             setheading(t)
42             #画叶子
43             pd()
44             right(90)
45             n = cos(radians(heading()-45))/4+0.5
46             pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)
47             circle(2)
48             left(90)
49             pu()
50             #返回
51             t=heading()
52             setheading(an)
53             backward(dis)
54             setheading(t)
55     pu()
56     backward(l)#退回
57 
58 bgcolor(0.5,0.5,0.5)#背景色
59 ht()#隐藏turtle
60 speed(0)#速度 1-10渐进,0 最快
61 tracer(0,0)
62 pu()#抬笔
63 backward(100)
64 left(90)#左转90度
65 pu()#抬笔
66 backward(300)#后退300
67 tree(12,100)#递归7层
68 done()
dark cherry
 1 from turtle import *
 2 from random import *
 3 from math import *
 4 
 5 def tree(n, l):
 6     pd()
 7     t = cos(radians(heading() + 45)) / 8 + 0.25
 8     pencolor(t, t, t)
 9     pensize(n / 4)
10     forward(l)
11     if n > 0:
12         b = random() * 15 + 10
13         c = random() * 15 + 10
14         d = l * (random() * 0.35 + 0.6)
15         right(b)
16         tree(n - 1, d)
17         left(b + c)
18         tree(n - 1, d)
19         right(c)
20     else:
21         right(90)
22         n = cos(radians(heading() - 45)) / 4 + 0.5
23         pencolor(n, n, n)
24         circle(2)
25         left(90)
26     pu()
27     backward(l)
28 bgcolor(0.5, 0.5, 0.5)
29 ht()
30 speed(0)
31 tracer(0, 0)
32 left(90)
33 pu()
34 backward(300)
35 tree(13, 100)
36 done()
blackcherry
  1 from turtle import *
  2 import time
  3 
  4 setup(1000,800,0,0)
  5 speed(0)
  6 penup()
  7 seth(90)
  8 fd(340)
  9 seth(0)
 10 pendown()
 11 
 12 speed(5)
 13 begin_fill()
 14 fillcolor('red')
 15 circle(50,30)
 16 
 17 for i in range(10):
 18     fd(1)
 19     left(10)
 20 
 21 circle(40,40)
 22 
 23 for i in range(6):
 24     fd(1)
 25     left(3)
 26 
 27 circle(80,40)
 28 
 29 for i in range(20):
 30     fd(0.5)
 31     left(5)
 32 
 33 circle(80,45)
 34 
 35 for i in range(10):
 36     fd(2)
 37     left(1)
 38 
 39 circle(80,25)
 40 
 41 for i in range(20):
 42     fd(1)
 43     left(4)
 44 
 45 circle(50,50)
 46 
 47 time.sleep(0.1)
 48 
 49 circle(120,55)
 50 
 51 speed(0)
 52 
 53 seth(-90)
 54 fd(70)
 55 
 56 right(150)
 57 fd(20)
 58 
 59 left(140)
 60 circle(140,90)
 61 
 62 left(30)
 63 circle(160,100)
 64 
 65 left(130)
 66 fd(25)
 67 
 68 penup()
 69 right(150)
 70 circle(40,80)
 71 pendown()
 72 
 73 left(115)
 74 fd(60)
 75 
 76 penup()
 77 left(180)
 78 fd(60)
 79 pendown()
 80 
 81 end_fill()
 82 
 83 right(120)
 84 circle(-50,50)
 85 circle(-20,90)
 86 
 87 speed(1)
 88 fd(75)
 89 
 90 speed(0)
 91 circle(90,110)
 92 
 93 penup()
 94 left(162)
 95 fd(185)
 96 left(170)
 97 pendown()
 98 circle(200,10)
 99 circle(100,40)
100 circle(-52,115)
101 left(20)
102 circle(100,20)
103 circle(300,20)
104 speed(1)
105 fd(250)
106 
107 penup()
108 speed(0)
109 left(180)
110 fd(250)
111 circle(-300,7)
112 right(80)
113 circle(200,5)
114 pendown()
115 
116 left(60)
117 begin_fill()
118 fillcolor('green')
119 circle(-80,100)
120 right(90)
121 fd(10)
122 left(20)
123 circle(-63,127)
124 end_fill()
125 
126 penup()
127 left(50)
128 fd(20)
129 left(180)
130 
131 pendown()
132 circle(200,25)
133 
134 penup()
135 right(150)
136 
137 fd(180)
138 
139 right(40)
140 pendown()
141 begin_fill()
142 fillcolor('green')
143 circle(-100,80)
144 right(150)
145 fd(10)
146 left(60)
147 circle(-80,98)
148 end_fill()
149 
150 penup()
151 left(60)
152 fd(13)
153 left(180)
154 
155 pendown()
156 speed(1)
157 circle(-200,23)
158 
159 
160 
161 exitonclick()
rose
 1 from turtle import *
 2 import random
 3 import time
 4 
 5 n = 100.0
 6 
 7 speed("fastest")
 8 screensize(bg='seashell')
 9 left(90)
10 forward(3*n)
11 color("orange", "yellow")
12 begin_fill()
13 left(126)
14 
15 for i in range(5):
16     forward(n/5)
17     right(144)
18     forward(n/5)
19     left(72)
20 end_fill()
21 right(126)
22 
23 color("dark green")
24 backward(n*4.8)
25 def tree(d, s):
26     if d <= 0: return
27     forward(s)
28     tree(d-1, s*.8)
29     right(120)
30     tree(d-3, s*.5)
31     right(120)
32     tree(d-3, s*.5)
33     right(120)
34     backward(s)
35 tree(15, n)
36 backward(n/2)
37 
38 for i in range(200):
39     a = 200 - 400 * random.random()
40     b = 10 - 20 * random.random()
41     up()
42     forward(b)
43     left(90)
44     forward(a)
45     down()
46     if random.randint(0, 1) == 0:
47             color('tomato')
48     else:
49         color('wheat')
50     circle(2)
51     up()
52     backward(a)
53     right(90)
54     backward(b)
55 
56 time.sleep(60)
christmas tree
  1 import turtle as te
  2 import time
  3 WriteStep = 15  # 贝塞尔函数的取样次数
  4 Speed = 5
  5 Width = 600  # 界面宽度
  6 Height = 500  # 界面高度
  7 Xh = 0  # 记录前一个贝塞尔函数的手柄
  8 Yh = 0
  9 
 10 
 11 def Bezier(p1, p2, t):  # 一阶贝塞尔函数
 12     return p1 * (1 - t) + p2 * t
 13 
 14 
 15 def Bezier_2(x1, y1, x2, y2, x3, y3):  # 二阶贝塞尔函数
 16     te.goto(x1, y1)
 17     te.pendown()
 18     for t in range(0, WriteStep + 1):
 19         x = Bezier(Bezier(x1, x2, t / WriteStep),
 20                    Bezier(x2, x3, t / WriteStep), t / WriteStep)
 21         y = Bezier(Bezier(y1, y2, t / WriteStep),
 22                    Bezier(y2, y3, t / WriteStep), t / WriteStep)
 23         te.goto(x, y)
 24     te.penup()
 25 
 26 
 27 def Bezier_3(x1, y1, x2, y2, x3, y3, x4, y4):  # 三阶贝塞尔函数
 28     x1 = -Width / 2 + x1
 29     y1 = Height / 2 - y1
 30     x2 = -Width / 2 + x2
 31     y2 = Height / 2 - y2
 32     x3 = -Width / 2 + x3
 33     y3 = Height / 2 - y3
 34     x4 = -Width / 2 + x4
 35     y4 = Height / 2 - y4  # 坐标变换
 36     te.goto(x1, y1)
 37     te.pendown()
 38     for t in range(0, WriteStep + 1):
 39         x = Bezier(Bezier(Bezier(x1, x2, t / WriteStep), Bezier(x2, x3, t / WriteStep), t / WriteStep),
 40                    Bezier(Bezier(x2, x3, t / WriteStep), Bezier(x3, x4, t / WriteStep), t / WriteStep), t / WriteStep)
 41         y = Bezier(Bezier(Bezier(y1, y2, t / WriteStep), Bezier(y2, y3, t / WriteStep), t / WriteStep),
 42                    Bezier(Bezier(y2, y3, t / WriteStep), Bezier(y3, y4, t / WriteStep), t / WriteStep), t / WriteStep)
 43         te.goto(x, y)
 44     te.penup()
 45 
 46 
 47 def Moveto(x, y):  # 移动到svg坐标下(x,y)
 48     te.penup()
 49     te.goto(-Width / 2 + x, Height / 2 - y)
 50 
 51 
 52 def line(x1, y1, x2, y2):  # 连接svg坐标下两点
 53     te.penup()
 54     te.goto(-Width / 2 + x1, Height / 2 - y1)
 55     te.pendown()
 56     te.goto(-Width / 2 + x2, Height / 2 - y2)
 57     te.penup()
 58 
 59 
 60 def lineto(dx, dy):  # 连接当前点和相对坐标(dx,dy)的点
 61     te.pendown()
 62     te.goto(te.xcor() + dx, te.ycor() - dy)
 63     te.penup()
 64 
 65 
 66 def Lineto(x, y):  # 连接当前点和svg坐标下(x,y)
 67     te.pendown()
 68     te.goto(-Width / 2 + x, Height / 2 - y)
 69     te.penup()
 70 
 71 
 72 def Horizontal(x):  # 做到svg坐标下横坐标为x的水平线
 73     te.pendown()
 74     te.setx(x - Width / 2)
 75     te.penup()
 76 
 77 
 78 def horizontal(dx):  # 做到相对横坐标为dx的水平线
 79     te.seth(0)
 80     te.pendown()
 81     te.fd(dx)
 82     te.penup()
 83 
 84 
 85 def vertical(dy):  # 做到相对纵坐标为dy的垂直线
 86     te.seth(-90)
 87     te.pendown()
 88     te.fd(dy)
 89     te.penup()
 90     te.seth(0)
 91 
 92 
 93 def polyline(x1, y1, x2, y2, x3, y3):  # 做svg坐标下的折线
 94     te.penup()
 95     te.goto(-Width / 2 + x1, Height / 2 - y1)
 96     te.pendown()
 97     te.goto(-Width / 2 + x2, Height / 2 - y2)
 98     te.goto(-Width / 2 + x3, Height / 2 - y3)
 99     te.penup()
100 
101 
102 def Curveto(x1, y1, x2, y2, x, y):  # 三阶贝塞尔曲线到(x,y)
103     te.penup()
104     X_now = te.xcor() + Width / 2
105     Y_now = Height / 2 - te.ycor()
106     Bezier_3(X_now, Y_now, x1, y1, x2, y2, x, y)
107     global Xh
108     global Yh
109     Xh = x - x2
110     Yh = y - y2
111 
112 
113 def curveto_r(x1, y1, x2, y2, x, y):  # 三阶贝塞尔曲线到相对坐标(x,y)
114     te.penup()
115     X_now = te.xcor() + Width / 2
116     Y_now = Height / 2 - te.ycor()
117     Bezier_3(X_now, Y_now, X_now + x1, Y_now + y1,
118              X_now + x2, Y_now + y2, X_now + x, Y_now + y)
119     global Xh
120     global Yh
121     Xh = x - x2
122     Yh = y - y2
123 
124 
125 def Smooth(x2, y2, x, y):  # 平滑三阶贝塞尔曲线到(x,y)
126     global Xh
127     global Yh
128     te.penup()
129     X_now = te.xcor() + Width / 2
130     Y_now = Height / 2 - te.ycor()
131     Bezier_3(X_now, Y_now, X_now + Xh, Y_now + Yh, x2, y2, x, y)
132     Xh = x - x2
133     Yh = y - y2
134 
135 
136 def smooth_r(x2, y2, x, y):  # 平滑三阶贝塞尔曲线到相对坐标(x,y)
137     global Xh
138     global Yh
139     te.penup()
140     X_now = te.xcor() + Width / 2
141     Y_now = Height / 2 - te.ycor()
142     Bezier_3(X_now, Y_now, X_now + Xh, Y_now + Yh,
143              X_now + x2, Y_now + y2, X_now + x, Y_now + y)
144     Xh = x - x2
145     Yh = y - y2
146 
147 te.tracer(10)
148 te.setup(Width, Height, 0, 0)
149 te.pensize(1)
150 te.speed(Speed)
151 te.penup()
152 
153 # 图层_2
154 time.sleep(20)
155 te.color("black", "#F2F2F2")  # 外套
156 Moveto(61, 462)
157 te.begin_fill()
158 smooth_r(12, -41, 27, -58)
159 curveto_r(-6, -36, 6, -118, 9, -132)
160 curveto_r(-15, -27, -23, -51, -26, -74)
161 curveto_r(4, -66, 38, -105, 65, -149)
162 Horizontal(486)
163 curveto_r(12, 24, 40, 99, 33, 114)
164 curveto_r(39, 82, 55, 129, 39, 144)
165 smooth_r(-31, 23, -39, 28)
166 smooth_r(-12, 37, -12, 37)
167 lineto(50, 92)
168 Horizontal(445)
169 smooth_r(-29, -38, -31, -46)
170 smooth_r(78, -107, 72, -119)
171 Smooth(355, 178, 340, 176)
172 Smooth(272, 63, 264, 64)
173 smooth_r(-29, 67, -27, 73)
174 Curveto(99, 292, 174, 428, 173, 439)
175 smooth_r(-8, 23, -8, 23)
176 Lineto(61, 462)
177 te.end_fill()
178 
179 Moveto(60.5, 461.5)  # 阴影
180 te.color("black", "#D3DFF0")
181 te.begin_fill()
182 curveto_r(0, 0, 17, -42, 27, -59)
183 curveto_r(-6, -33, 6, -128, 10, -133)
184 curveto_r(-15, -10, -27, -66, -27.285, -75)
185 te.pencolor("#D3DFF0")
186 curveto_r(12.285, 11, 82.963, 156, 82.963, 156)
187 te.pencolor("black")
188 smooth_r(12.322, 75, 19.322, 86)
189 curveto_r(-1, 11, -8, 25, -8, 25)
190 Horizontal(60.5)
191 te.end_fill()
192 
193 Moveto(444.5, 464)
194 te.begin_fill()
195 curveto_r(0, 0, -29, -36, -31, -46)
196 smooth_r(53.59, -82.337, 53.59, -82.337)
197 te.pencolor("#D3DFF0")
198 smooth_r(86.41, -47.663, 96.072, -54.85)
199 Curveto(563.5, 297.5, 570.5, 299.5, 518.5, 334)
200 te.pencolor("black")
201 curveto_r(-2, 16, -12, 33, -12, 37)
202 smooth_r(50, 92, 50, 93)
203 Horizontal(444.5)
204 te.end_fill()
205 
206 Moveto(195, 49)
207 te.begin_fill()
208 te.pencolor("#D3DFF0")
209 polyline(195, 49, 175.5, 106.5, 202.522, 49)
210 te.pencolor("black")
211 Horizontal(195)
212 te.pencolor("#D3DFF0")
213 te.end_fill()
214 
215 Moveto(327.997, 49)
216 te.begin_fill()
217 te.pencolor("#D3DFF0")
218 curveto_r(0, 0, 11.503, 121.087, 13.503, 128.087)
219 curveto_r(11, 2, 54, 37, 54, 37)
220 lineto(-40, -165.087)
221 te.pencolor("black")
222 Horizontal(327.997)
223 te.pencolor("#D3DFF0")
224 te.end_fill()
225 
226 te.pencolor("black")
227 line(94.5, 397.5, 107.5, 373.5)  # 皱纹
228 line(122.5, 317.5, 95.875, 274.699)
229 line(122.5, 341.5, 141.5, 402.5)
230 line(141.5, 409.5, 153.5, 431.5)
231 # line(328,47.712,344,175.977)
232 line(340.023, 49, 360.5, 144)
233 # line(353.5,47.5,395.5,208.5)
234 line(478.5, 95.5, 518.5, 161.5)
235 line(518.5, 332.5, 460.5, 359.5)
236 polyline(506.5, 369.5, 493.5, 402.5, 502.5, 443.5)
237 Moveto(530, 429)
238 curveto_r(4, 16, -5, 33, -5, 33)
239 
240 # 图层_3
241 te.color("black", "#2b1d2a")  # 外套内侧
242 Moveto(225, 462)
243 te.begin_fill()
244 Horizontal(165)
245 smooth_r(9, -15, 8, -25)
246 curveto_r(-47, -126, 6, -212, 12, -225)
247 Curveto(185, 305, 202, 428, 225, 462)
248 Lineto(225, 462)
249 te.end_fill()
250 
251 Moveto(390, 462)
252 te.begin_fill()
253 curveto_r(10, -23, 34, -180, 35, -222)  # !!!227
254 curveto_r(7, 4, 54, 45, 61, 61)  # 61
255 smooth_r(-73, 101, -72, 118)
256 curveto_r(5, 15, 31, 46, 31, 45)
257 Lineto(390, 462)
258 te.end_fill()
259 # 图层_4
260 te.color("black", "#2b1d29")  # 外套内侧
261 Moveto(225, 462)
262 te.begin_fill()
263 curveto_r(-28, -50, -40, -166, -40, -250)
264 curveto_r(6, 51, -6, 87, 45, 106)
265 smooth_r(64, 27, 89, 24)
266 smooth_r(49, -18, 56, -20)
267 smooth_r(50, -10, 51, -85)
268 curveto_r(0, 29, -25, 201, -36, 225)
269 Lineto(225, 462)
270 te.end_fill()
271 # 图层_5
272 te.color("black", "#3D3D3D")  # 衣服
273 Moveto(225, 462)
274 te.begin_fill()
275 curveto_r(-5, -5, -22, -53, -23, -70)
276 lineto(32, -13)
277 curveto_r(3, -25, 6, -28, 12, -36)
278 smooth_r(13, -12, 16, -12)
279 vertical(-2)
280 curveto_r(45, 20, 64, 14, 94, 1)
281 vertical(2)
282 curveto_r(8, -2, 15, 2, 17, 4)
283 smooth_r(0, 6, -2, 9)
284 curveto_r(10, 10, 10, 29, 11, 33)
285 smooth_r(23, 4, 25, 6)
286 smooth_r(-17, 83, -17, 78)
287 Lineto(225, 462)
288 te.end_fill()
289 # 图层_6
290 te.color("black", "#968281")  # 脖子
291 Moveto(262, 329)
292 te.begin_fill()
293 vertical(17)
294 curveto_r(1, 2, 44, 14, 45, 15)
295 smooth_r(3, 12, 3, 12)
296 horizontal(3)
297 vertical(-5)
298 curveto_r(1, -3, 4, -6, 5, -7)
299 lineto(36, -14)
300 curveto_r(1, -1, 3, -16, 2, -17)
301 Curveto(318, 348, 296, 344, 262, 329)
302 te.end_fill()
303 # 图层_8
304 te.color("black", "#E7F1FF")  # 白色褶皱
305 Moveto(225, 462)
306 te.begin_fill()
307 lineto(-3, -5)  # -3,-3,-3,-5
308 curveto_r(0, -2, 4, -4, 5, -6)
309 smooth_r(16, 3, 19, -8)
310 smooth_r(0, -7, 0, -11)
311 smooth_r(5, -8, 9, -5)
312 smooth_r(19, -8, 19, -11)
313 smooth_r(6, -7, 6, -7)
314 smooth_r(7, -2, 9, -4)
315 lineto(41, -2)
316 lineto(12, 9)
317 smooth_r(3, 15, 7, 18)
318 smooth_r(15, 4, 17, 4)
319 smooth_r(4, -4, 6, -4)
320 smooth_r(6, 4, 5, 9)
321 smooth_r(0, 9, 0, 9)
322 smooth_r(1, 7, 7, 6)
323 smooth_r(8, 0, 8, 0)
324 lineto(-2, 8)
325 Lineto(225, 462)
326 te.end_fill()
327 
328 te.pensize(2)
329 Moveto(240, 450)
330 smooth_r(0, 9, 3, 12)
331 Moveto(372, 462)
332 curveto_r(-2, -4, -5, -29, -7, -28)
333 te.pensize(1)
334 # 图层_7
335 te.color("black", "#A2B8D6")  # 衣领
336 Moveto(262, 331)
337 te.begin_fill()
338 curveto_r(0, 8, -1, 13, 0, 15)
339 smooth_r(43, 14, 45, 15)
340 lineto(3, 12)
341 horizontal(3)
342 smooth_r(-1, -3, 0, -5)
343 lineto(5, -7)
344 lineto(36, -14)
345 curveto_r(1, -1, 2, -12, 2, -15)
346 smooth_r(25, -2, 15, 13)
347 curveto_r(-2, 4, -7, 29, -7, 32)
348 smooth_r(-35, 19, -41, 22)
349 smooth_r(-9, 14, -12, 14)
350 smooth_r(-7, -12, -14, -15)
351 curveto_r(-19, -2, -41, -25, -41, -25)
352 smooth_r(-10, -26, -10, -30)
353 Smooth(255, 332, 262, 331)
354 te.end_fill()
355 
356 Moveto(262, 346)
357 lineto(-12, -6)
358 Moveto(369, 333)
359 curveto_r(2, 4, -6, 10, -15, 14)
360 # 图层_9
361 te.color("black", "#151515")  # 领结
362 Moveto(247, 358)
363 te.begin_fill()
364 curveto_r(-5, 3, -8, 20, -6, 23)
365 curveto_r(25, 21, 50, 17, 50, 17)
366 lineto(-23, 64)
367 horizontal(22)
368 smooth_r(1, -13, 2, -16)
369 lineto(13, -50)
370 curveto_r(2, 2, 7, 3, 10, 1)
371 smooth_r(18, 65, 18, 65)
372 horizontal(19)
373 lineto(-24, -65)
374 curveto_r(21, 5, 39, -10, 44, -13)
375 curveto_r(5, -20, 1, -21, 0, -24)
376 curveto_r(-18, -2, -49, 15, -52, 17)
377 smooth_r(-11, -3, -15, -1)
378 Smooth(252, 356, 247, 358)
379 te.end_fill()
380 # 图层_10
381 te.color("black", "#A2B8D6")  # 衣领(透过领结)
382 Moveto(297, 387)
383 te.begin_fill()
384 lineto(-11, 6)
385 curveto_r(-1, 0, -20, -7, -30, -19)
386 Curveto(259, 373, 297, 385, 297, 387)
387 te.end_fill()
388 
389 Moveto(323, 384)
390 te.begin_fill()
391 lineto(8, 7)
392 lineto(30, -14)
393 curveto_r(1, -1, 5, -6, 4, -7)
394 Smooth(329, 379, 323, 384)
395 te.end_fill()
396 # 图层_11
397 te.color("black", "#F3EEEB")  #
398 Moveto(185, 212)
399 te.begin_fill()
400 curveto_r(4, -9, 46, -77, 52, -75)
401 curveto_r(-2, -17, 19, -68, 27, -73)
402 curveto_r(16, 15, 71, 108, 76, 112)
403 smooth_r(76, 53, 86, 60)
404 curveto_r(0, 65, -27, 75, -31, 76)
405 curveto_r(-50, 28, -70, 30, -85, 30)
406 smooth_r(-77, -22, -86, -26)
407 Curveto(180, 302, 186, 228, 185, 212)
408 te.end_fill()
409 # 图层_12
410 te.color("black", "#2B1D29")  # 头发
411 Moveto(189, 202)
412 te.begin_fill()
413 curveto_r(-1, 22, 19, 51, 19, 51)
414 smooth_r(-10, -42, 7, -92)
415 Curveto(212, 168, 196, 189, 189, 202)
416 te.end_fill()
417 
418 Moveto(221, 155)
419 te.begin_fill()
420 curveto_r(-2, 6, 5, 48, 5, 48)
421 smooth_r(18, -28, 20, -48)
422 curveto_r(-5, 24, 4, 43, 7, 50)
423 curveto_r(-10, -49, 3, -72, 13, -106)
424 curveto_r(-2, -7, -3, -32, -3, -35)
425 curveto_r(-17, 18, -27, 71, -27, 71)
426 Lineto(221, 155)
427 te.end_fill()
428 
429 Moveto(264, 64)
430 te.begin_fill()
431 curveto_r(-4, 5, 14, 100, 14, 100)
432 smooth_r(-6, -79, -5, -85)
433 curveto_r(0, 98, 49, 139, 49, 139)
434 smooth_r(8, -50, 3, -65)
435 Smooth(272, 64, 264, 64)
436 te.end_fill()
437 
438 Moveto(342, 176)
439 te.begin_fill()
440 curveto_r(-1, 27, -10, 57, -10, 57)
441 smooth_r(20, -33, 17, -54)
442 Lineto(342, 176)
443 te.end_fill()
444 
445 te.penup()
446 te.begin_fill()
447 polyline(349, 180, 353, 203, 361, 203)
448 polyline(361, 203, 362, 188, 349, 180)
449 te.end_fill()
450 # 图层_13
451 te.pensize(2)
452 Moveto(210, 180)  # 眉毛
453 curveto_r(5, -4, 63, 9, 63, 14)
454 Moveto(338, 193)
455 curveto_r(0, -3, 18, -6, 18, -6)
456 te.pensize(1)
457 # 图层_14
458 te.color("black", "#D1D1D1")  # 眼睛1
459 te.pensize(2)
460 Moveto(206, 212)
461 te.begin_fill()
462 lineto(15, -7)
463 curveto_r(4, -1, 26, -2, 30, 0)
464 smooth_r(10, 3, 12, 7)
465 te.pencolor("#D1D1D1")
466 te.pensize(1)
467 smooth_r(2, 27, -1, 30)
468 smooth_r(-39, 5, -44, 1)
469 Smooth(206, 212, 206, 212)
470 te.end_fill()
471 
472 Moveto(384, 204)
473 te.begin_fill()
474 te.pencolor("black")
475 te.pensize(2)
476 curveto_r(-3, -1, -18, -1, -28, 1)
477 smooth_r(-9, 6, -10, 9)
478 te.pencolor("#D1D1D1")
479 te.pensize(1)
480 smooth_r(3, 18, 6, 23)
481 smooth_r(38, 6, 40, 4)
482 smooth_r(10, -9, 13, -22)
483 te.pencolor("black")
484 te.pensize(2)
485 Lineto(384, 204)
486 te.end_fill()
487 # 图层_15
488 te.color("#0C1631", "#0C1631")  # 眼睛2
489 te.pensize(1)
490 Moveto(216, 206)
491 te.begin_fill()
492 curveto_r(-1, 5, 0, 26, 7, 35)
493 smooth_r(30, 2, 33, 0)
494 smooth_r(5, -31, 2, -34)
495 Smooth(219, 203, 216, 206)
496 te.end_fill()
497 
498 Moveto(354, 207)
499 te.begin_fill()
500 curveto_r(-2, 1, 2, 29, 4, 31)
501 smooth_r(30, 3, 33, 1)
502 smooth_r(6, -24, 4, -27)
503 lineto(-11, -8)
504 Curveto(382, 204, 357, 206, 354, 207)
505 te.end_fill()
506 
507 # 图层_17
508 te.color("#F5F5F5", "#F5F5F5")  # 眼睛3
509 Moveto(253, 211)
510 te.begin_fill()
511 curveto_r(-3, 0, -8, 8, 1, 10)
512 Smooth(258, 210, 253, 211)
513 te.end_fill()
514 
515 Moveto(392, 209)
516 te.begin_fill()
517 lineto(4, 3)
518 vertical(4)
519 lineto(-4, 2)
520 Curveto(386, 214, 392, 209, 392, 209)
521 te.end_fill()
522 # 图层_18
523 te.color("#352F53", "#352F53")  # 眼睛4
524 Moveto(219, 229)
525 te.begin_fill()
526 smooth_r(2, -5, 6, -4)
527 smooth_r(18, 13, 27, 1)
528 curveto_r(3, 0, 5, 3, 5, 3)
529 vertical(13)
530 Horizontal(224)
531 Lineto(219, 229)
532 te.end_fill()
533 
534 Moveto(357, 227)
535 te.begin_fill()
536 smooth_r(4, -6, 10, -2)
537 smooth_r(10, 13, 19, 1)
538 curveto_r(6, 0, 8, 6, 8, 6)
539 lineto(-2, 9)
540 curveto_r(-12, 3, -29, 0, -32, -2)
541 Smooth(357, 227, 357, 227)
542 te.end_fill()
543 
544 # 图层_19
545 te.color("#9A90CB", "#9A90CB")  # 眼睛5
546 Moveto(227, 231)
547 te.begin_fill()
548 curveto_r(-6, 0, -5, 5, -3, 8)
549 smooth_r(24, 2, 27, 0)
550 smooth_r(0, -8, -1, -8)
551 Smooth(234, 231, 227, 231)
552 te.end_fill()
553 
554 Moveto(361, 227)
555 te.begin_fill()
556 curveto_r(2, 18, 26, 14, 30, 6)
557 smooth_r(-1, -3, -2, -4)
558 smooth_r(-15, 9, -24, -4)
559 Curveto(363, 224, 361, 225, 361, 227)
560 te.end_fill()
561 
562 # 图层_16
563 te.pencolor("black")  # 眼睛(线条)
564 te.pensize(3)
565 # Moveto(206,213)
566 # lineto(14,-8)
567 # curveto_r(3,-1,30,0,33,1)
568 # lineto(10,6)
569 Moveto(225, 215)
570 curveto_r(10, 28, 22, 16, 24, 6)
571 Moveto(365, 219)
572 curveto_r(4, 14, 18, 24, 22, -3)
573 te.pensize(2)
574 line(240.5, 207.5, 227.5, 211.5)
575 line(245.5, 209.5, 227.5, 214.5)
576 line(247.5, 211.5, 227.5, 217.5)
577 line(247.5, 214.5, 229.5, 220.5)
578 line(247.5, 218.5, 230.5, 223.5)
579 line(246.5, 222.5, 232.5, 226.5)
580 line(244.5, 225.5, 234.5, 228.5)
581 
582 line(377.5, 207.5, 367.5, 210.5)
583 line(384.5, 207.5, 366.5, 212.5)
584 line(385.5, 210.5, 366.5, 215.5)
585 line(384.5, 213.5, 366.5, 218.5)
586 line(384.5, 215.5, 367.5, 220.5)
587 line(384.5, 218.5, 368.5, 223.5)
588 # line(383.5,220.5,368.5,225.5)
589 line(382.5, 223.5, 370.5, 227.5)
590 # line(381.5,226.5,373.5,229.5)
591 # 图层_20
592 te.pencolor("black")
593 Moveto(309, 270)  # 鼻子、嘴
594 curveto_r(0, 0, 4, 7, 1, 9)
595 line(296.5, 307.5, 303.5, 307.5)
596 Moveto(315, 307)
597 smooth_r(10, -1, 10, 2)
598 
599 te.penup()
600 te.hideturtle()
601 te.update()
602 te.done()
carton

 

posted @ 2020-02-27 11:44  flyingswallow  阅读(677)  评论(0编辑  收藏  举报