海綿寶寶
工具使用
開發工具:pycharm
開發環境:python3.7, Windows10
使用工具包:turtle
效果展示

專案思路決議
明確turtle基本配置,然后我們在確定畫框的高度以及畫筆的大小,還有對應畫框標題和畫筆運行的速度,
screensize(800, 600, 'white')
pensize(3)
title('海綿寶寶')
speed(19)
首先咱們調整畫筆位置,找到對應原點位置
def go_to(x, y):
penup()
goto(x, y)
pendown()
?
go_to(0, 0)
畫出海綿寶寶的頭部海綿,選取對應寬度,坐標大小可自行調整 定位的函式可以重復使用,海綿寶寶周圍為波浪線,添加上對應的弧度,添加上黃色~嘿嘿
def head():
go_to(-200, 180)
fillcolor('yellow')
begin_fill()
seth(-30)
for _ in range(6):
circle(36, 60)
circle(-36, 60)
seth(-125)
for _ in range(5):
circle(40,60)
circle(-40,60)
seth(-210)
for _ in range(4):
circle(45,60)
circle(-45,60)
seth(65)
for _ in range(5):
circle(40,60)
circle(-40,60)
end_fill()
?
什么都沒有的海綿寶寶身體,
[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-z1Wn0tZd-1628659173024)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/0da3a3a8f011432898d26c7e2b45a146~tplv-k3u1fbpfcp-zoom-1.image)]
給海綿寶寶添加上面部表情,眼睛的資料多為圓弧,鼻子為小倒勾尺寸可自行調整,ps:別調整為整容海綿寶寶啦,哈哈哈
def eye():
# 眼白
go_to(14, -5)
fillcolor('#f0f0f0')
begin_fill()
circle(65, 360)
end_fill()
begin_fill()
go_to(13,12)
seth(98)
circle(-65,360)
end_fill()
?
#眼球
go_to(-10,20)
fillcolor('blue')
begin_fill()
circle(20,360)
end_fill()
go_to(-22,20)
fillcolor('black')
begin_fill()
circle(7,360)
end_fill()
go_to(40,15)
fillcolor('blue')
begin_fill()
circle(-20, 360)
end_fill()
go_to(53,15)
fillcolor('black')
begin_fill()
circle(-7,360)
end_fill()
?
#睫毛
go_to(-95,65)
left(20)
forward(40)
go_to(-50,87)
right(25)
forward(32)
go_to(0,70)
right(25)
forward(40)
?
go_to(40, 75)
left(35)
forward(40)
go_to(90, 87)
right(18)
forward(30)
go_to(120, 70)
right(25)
forward(40)
?
def nose():
fillcolor('yellow')
go_to(0, -7)
begin_fill()
right(50)
circle(-60, 30)
color('yellow')
goto(15,-40)
end_fill()
color('black')
go_to(0, -7)
seth(-75)
forward(30)
go_to(30,-7)
seth(-105)
forward(30)
這是畫上眼睛的海綿寶寶~

添加上嘴 加上海綿寶寶有代表性的大白牙
def mouth():
go_to(-120, - 60)
seth(-45)
circle(200, 30)
seth(0)
forward(100)
seth(15)
circle(200, 30)
?
def tooth():
go_to(-30,-114)
seth(-95)
fillcolor('white')
begin_fill()
forward(30)
seth(0)
forward(40)
seth(95)
forward(30)
go_to(-30,-114)
end_fill()
?
go_to(30, -114)
seth(-95)
fillcolor('white')
begin_fill()
forward(30)
seth(0)
forward(40)
seth(95)
forward(30)
go_to(60, -114)
end_fill()
?
這大門牙有點像兔子,引數也可以自己調整,嘿嘿

面部完成之后開始完善身體的一些結構增加小白襯衫和海綿寶寶的手臂,
def body():
go_to(-170,-180)
seth(-120)
circle(150, 30)
seth(0)
forward(40)
seth(100)
forward(35)
seth(-80)
forward(100)
fillcolor('brown')
begin_fill()
seth(0)
forward(300)
seth(80)
forward(110)
seth(-100)
forward(65)
seth(180)
forward(315)
go_to(-118,-400)
end_fill()
go_to(-170,-255)
fillcolor('yellow')
begin_fill()
seth(-75)
forward(80)
seth(0)
forward(17)
seth(105)
forward(85)
end_fill()
?
go_to(200, -170)
seth(-60)
circle(-150,30)
seth(-180)
forward(45)
begin_fill()
seth(0)
forward(20)
seth(-100)
forward(85)
seth(180)
forward(20)
end_fill()
?
你是不是覺得可以了,不不不,還有非常重要的一點,那就是它的紅色紅領巾啦,

最后一步給添加海綿寶寶的紅色紅領巾
def tie():
go_to(-50,-225)
seth(-40)
forward(40)
seth(30)
forward(52)
go_to(30,-225)
seth(-30)
forward(40)
seth(40)
forward(45)
fillcolor('red')
go_to(0, -240)
begin_fill()
seth(-60)
forward(10)
seth(0)
forward(30)
seth(60)
forward(15)
go_to(30,-225)
end_fill()
go_to(4,-250)
begin_fill()
seth(-100)
forward(80)
seth(0)
forward(55)
seth(100)
forward(80)
end_fill()
細節方面大佬可以自行調整,喜歡嗎?喜歡的可以給我點亮一下大拇指呀~

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/293614.html
標籤:python
