Turtle庫畫小貓咪

這個是用python庫畫的小貓咪,前面一步步的畫整個貓的整個身體,具體步驟都寫在了註釋之中。身體部分畫的比較快,後面畫了5個心,因爲畫心的時候要改變好多度數,並且每次只前進一點點,因此畫心的時候會比較慢,你們在看視頻的時候會發現這一點。這個東西花了好個小時畫出來,好多地方都是幾像素幾像素的試出來的。不過,我畫畫能力通常,加上時間有限,並不能完善全部細節。可是我儘量多的完善了一些線條和佈局,弧度之類的的細節,但願你們喜歡咱們的做品。
但願你們多多支持咱們的做品喲!
from turtle import *
#兩個函數用於畫心
def curvemove():
    for i in range(200):
        right(1)
        forward(0.1)
def heart(x,y,s):
    pu()
    goto(x,y)
    seth(s)
    pendown()
    begin_fill()
    left(140)
    forward(11.1)
    curvemove()
    left(120)
    curvemove()
    forward(11.1)
    end_fill()
#初始化
setup(600,600)
pu()
goto(60,100)
pensize(4)
pendown()
#畫左半邊的頭
for i in range(150,212,2):
    seth(i)
    fd(3)
seth(145)
fd(50)
left(125)
fd(50)
for i in range(240,318,2):
    if i==290:
        seth(190)
        fd(10)
        seth(10)
        fd(10)
    elif i==300:
        seth(200)
        fd(10)
        seth(20)
        fd(10)
    seth(i)
    fd(3)
#畫右半邊的頭
pu()
goto(60,100)
pendown()
seth(45)
fd(50)
right(125)
fd(50)
for i in range(-60,-138,-2):
    if i==-110:
        seth(-10)
        fd(10)
        seth(170)
        fd(10)
    elif i==-120:
        seth(-20)
        fd(10)
        seth(160)
        fd(10)
    seth(i)
    fd(3)
#頭部到這裏就畫好外觀了
seth(-40)
fd(52)
seth(-135)
fd(45)
pu()
seth(-105)
fd(5)
pendown()
fd(17)
for i in range(130,106,-3):
    seth(i)
    fd(2.5)
for i in range(106,30,-10):
    seth(i)
    fd(2)
seth(38)
fd(25)
seth(135)
fd(31)
seth(169)
fd(6)
seth(270)
fd(105)
#右邊的身子畫好了
#開始畫左邊的身子
pu()
goto(-52,-30)
pendown()
seth(220)
fd(48)#52
seth(250)
fd(3)
seth(270)
fd(3)
seth(290)
fd(2)
seth(-40)
fd(44)
seth(228)
fd(20)
seth(5)
fd(22)
#畫叉腰的動做
pu()
goto(-52,-84)
seth(133)
pendown()
fd(22)
seth(90)
fd(2)
seth(60)
fd(2)
seth(45)
fd(29)
seth(0)
fd(3)
seth(-93)
fd(102)
#叉腰動做結束 接下來畫嘴巴 眼睛
pu()
goto(-43,38)
seth(0)
pendown()
begin_fill()
circle(5)
end_fill()
pu()
fd(108)
pendown()
begin_fill()
circle(5)
end_fill()
#調色環節
pu()
goto(60,24)
pencolor("pink")
pensize(6)
seth(225)
pendown()
fd(7)
pu()
goto(70,24)
seth(225)
pendown()
fd(7)
#右半邊調色完畢
pu()
goto(-49,24)
seth(225)
pendown()
fd(7)
#畫嘴巴
pu()
pensize(4)
pencolor("black")
goto(5,21)
seth(-45)
pendown()
fd(5)
goto(5,21)
seth(225)
fd(5)
#左邊的顏色
pu()
pencolor("pink")
pensize(6)
goto(-39,24)
seth(225)
pendown()
fd(7)

#給耳朵填充顏色
pu()
goto(-40,92)
seth(80)
pendown()
fillcolor("pink")
begin_fill()
circle(14,360,3)
end_fill()
pu()
goto(72,100)
seth(-74)
pendown()
begin_fill()
circle(14,360,3)
end_fill()
#酷酷的黑翅膀
pu()
pensize(4)
color('black', 'black')
begin_fill()
goto(-90,-35)
seth(135)
pendown()
fd(25)
seth(225)
fd(45)
seth(25)
fd(15)
seth(-80)
pensize(2)
fd(15)
seth(55)
fd(15)
seth(25)
fd(10)
seth(-80)
fd(15)
seth(75)
fd(15)
goto(-90,-35)
end_fill()
#最後一個翅膀
pu()
goto(125,-30)
seth(45)
pendown()
begin_fill()
fd(25)
seth(-45)
fd(45)
seth(155)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
seth(170)
fd(15)
seth(-80)
fd(15)
seth(120)
fd(17)
goto(125,-30)
end_fill()

#畫5顆心
speed(10)
color('red', 'pink')
pensize(2)
heart(0,140,0)
heart(-125,0,30)
heart(140,0,-30)
heart(145,-85,-30)
heart(-132,-85,30)
exitonclick()
相關文章
相關標籤/搜索