人已阳,准备画个喜羊羊纪念一下,但是喜羊羊头上的卷太多了,不太好画,于是找了参考文献1的普通的简笔画羊,使用Python中的turtle模块绘制(采用参考文献3中绘制云朵的代码绘制羊身体)。
绘制简笔画羊的代码及效果图如下所示:
import turtle as t
def drawBody():
t.penup()
t.setheading(-90)
t.forward(-10)
t.setheading(0)
t.forward(45+40)
t.pendown();
t.setheading(80)
t.circle(-15,180)
t.setheading(80)
t.circle(-15,180)
t.setheading(80)
t.circle(-10,180)
t.setheading(80)
t.circle(-18,180)
t.setheading(80)
t.circle(-20,180)
t.setheading(30)
t.circle(-10,180)
t.setheading(0)
t.circle(-20,180)
t.setheading(-30)
t.circle(-10,180)
t.setheading(-45)
t.circle(-15,180)
t.setheading(-80)
t.circle(-18,180)
t.setheading(-90)
t.circle(-10,180)
t.setheading(-90)
t.circle(-12,180)
t.setheading(-110)
t.circle(-15,180)
t.setheading(-120)
t.circle(-15,180)
def drawHead():
t.setheading(-45)
t.forward(20)
t.setheading(-145)
t.circle(-15,90)
t.setheading(85)
t.forward(5)
t.backward(50)
t.setheading(-90)
t.circle(-15,90)
t.forward(25)
t.circle(-50,80)
t.setheading(80)
t.forward(50)
t.setheading(-145)
t.circle(-15,90)
t.setheading(-200)
t.circle(-15,-90)
t.penup()
t.setheading(0)
t.forward(25)
t.right(90)
t.forward(30)
t.pendown()
t.circle(5)
t.penup()
t.setheading(-30)
t.forward(40)
t.pendown()
t.circle(5)
t.penup()
t.setheading(-180)
t.forward(10)
t.setheading(-120)
t.forward(10)
t.pendown()
t.forward(10)
t.right(120)
t.forward(10)
t.backward(10)
t.setheading(-90)
t.forward(15)
def drawHair():
t.penup()
t.setheading(90)
t.forward(90)
t.setheading(180)
t.forward(45)
t.pendown();
t.circle(-30,90)
t.left(15)
t.circle(-20,-90)
t.penup()
t.setheading(-5)
t.forward(130)
t.pendown();
t.right(90)
t.circle(-20,90)
t.penup()
t.circle(-20,-90)
t.pendown();
t.setheading(-240)
t.circle(30,-120)
t.penup()
t.setheading(90)
t.forward(60)
t.setheading(180)
t.forward(100)
t.pendown();
t.setheading(90)
t.circle(-15,180)
t.setheading(90)
t.circle(-20,180)
t.setheading(90)
t.circle(-15,180)
t.setheading(0)
t.circle(-15,180)
t.setheading(-90)
t.circle(-15,180)
t.setheading(-90)
t.circle(-15,180)
t.setheading(-90)
t.circle(-10,180)
t.setheading(0)
t.circle(15,-150)
def drawTail():
t.penup()
t.setheading(88)
t.forward(60)
t.setheading(0)
t.forward(177)
t.pendown();
t.setheading(80)
t.circle(-10,180)
t.setheading(30)
t.circle(-8,180)
t.setheading(-80)
t.circle(-10,180)
def drawLegs():
t.penup()
t.setheading(-90)
t.forward(60)
t.setheading(-180)
t.forward(177)
t.pendown();
t.setheading(-90)
t.forward(60)
t.left(90)
t.forward(15)
t.right(90)
t.backward(50)
t.forward(60)
t.left(90)
t.forward(15)
t.left(90)
t.forward(50)
t.backward(35)
t.setheading(0)
t.backward(30)
t.penup()
t.setheading(90)
t.forward(40)
t.setheading(0)
t.forward(100)
t.pendown();
t.pendown();
t.setheading(-90)
t.forward(50)
t.left(90)
t.forward(15)
t.right(90)
t.backward(50)
t.forward(60)
t.left(90)
t.forward(15)
t.left(90)
t.forward(65)
t.backward(50)
t.setheading(0)
t.backward(30)
def drawGrass():
t.color('black','green')
t.penup()
t.goto(-200,-50)
t.pendown()
t.begin_fill()
t.setheading(75)
t.forward(20)
t.setheading(-75)
t.forward(15)
t.setheading(75)
t.forward(15)
t.setheading(-75)
t.forward(15)
t.setheading(75)
t.forward(15)
t.setheading(-75)
t.forward(20)
t.setheading(-180)
t.forward(25)
t.end_fill()
t.penup()
t.goto(200,-50)
t.pendown()
t.begin_fill()
t.setheading(75)
t.forward(20)
t.setheading(-75)
t.forward(15)
t.setheading(75)
t.forward(15)
t.setheading(-75)
t.forward(15)
t.setheading(75)
t.forward(15)
t.setheading(-75)
t.forward(20)
t.setheading(-180)
t.forward(25)
t.end_fill()
t.pensize(2)
drawHead()
drawHair()
drawBody()
drawTail()
drawLegs()
drawGrass()
t.hideturtle()
t.done()
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
参考文献:
[1]https://jingyan.baidu.com/article/6c67b1d6e80bd26687bb1e9f.html
[2]https://docs.python.org/zh-cn/3/library/turtle.html
[3]https://blog.csdn.net/Jane_Eyre111/article/details/121563066