文章目录


前言

随着一个个动漫的出现,一个又一个的鲜活的动漫人物纷纷出现,例如:海绵宝宝,派大星,还有

樱桃小丸子等等,我展示的是其中三种:小黄人小猪佩奇和蜘蛛侠。


一、画小黄人

小黄人用椭圆和seth()就能做出来,有些潦草,上代码:

import turtle

t = turtle.Turtle()
wn = turtle.Screen()
turtle.colormode(255)
t.hideturtle()
t.speed(0)
t.penup()
t.pensize(4)
t.goto(100, 0)
t.pendown()
t.left(90)
t.color((0, 0, 0), (255, 255, 0))
t.begin_fill()
t.forward(200)
t.circle(100, 180)
t.forward(200)
t.circle(100, 180)
t.end_fill()
t.pensize(12)
t.penup()
t.goto(-100, 200)
t.pendown()
t.right(100)
t.circle(500, 23)
t.pensize(3)
t.penup()
t.goto(0, 200)
t.pendown()
t.seth(270)
t.color("black", "white")
t.begin_fill()
t.circle(30)
t.end_fill()
t.penup()
t.goto(15, 200)
t.pendown()
t.color("black", "black")
t.begin_fill()
t.circle(15)
t.end_fill()
t.penup()
t.goto(35, 205)
t.color("black", "white")
t.begin_fill()
t.circle(5)
t.end_fill()
t.pensize(3)
t.penup()
t.goto(0, 200)
t.pendown()
t.seth(90)
t.color("black", "white")
t.begin_fill()
t.circle(30)
t.end_fill()
t.penup()
t.goto(-15, 200)
t.pendown()
t.color("black", "black")
t.begin_fill()
t.circle(15)
t.end_fill()
t.penup()
t.goto(-35, 205)
t.color("black", "white")
t.begin_fill()
t.circle(5)
t.end_fill()
t.penup()
t.goto(-20, 100)
t.pendown()
t.seth(270)
t.color("black", "white")
t.begin_fill()
t.circle(20, 180)
t.left(90)
t.forward(40)
t.end_fill()
t.penup()
t.goto(-100, 0)
t.pendown()
t.seth(0)
t.color("black", "blue")
t.begin_fill()
t.forward(20)
t.left(90)
t.forward(40)
t.right(90)
t.forward(160)
t.right(90)
t.forward(40)
t.left(90)
t.forward(20)
t.seth(270)
t.penup()
t.goto(-100, 0)
t.circle(100, 180)
t.end_fill()
t.penup()
t.goto(-70, 20)
t.pendown()
t.color("black", "blue")
t.begin_fill()
t.seth(45)
t.forward(15)
t.left(90)
t.forward(60)
t.seth(270)
t.forward(15)
t.left(40)
t.forward(50)
t.end_fill()
t.left(180)
t.goto(-70, 30)
t.dot()
t.penup()
t.goto(70, 20)
t.pendown()
t.color("black", "blue")
t.begin_fill()
t.seth(135)
t.forward(15)
t.right(90)
t.forward(60)
t.seth(270)
t.forward(15)
t.right(40)
t.forward(50)
t.end_fill()
t.left(180)
t.goto(70, 30)
t.dot()
t.penup()
t.goto(4, -100)
t.pendown()
t.seth(270)
t.color("black", "black")
t.begin_fill()
t.forward(30)
t.left(90)
t.forward(40)
t.seth(20)
t.circle(10, 180)
t.circle(400, 2)
t.seth(90)
t.forward(20)
t.goto(4, -100)
t.end_fill()
t.penup()
t.goto(-4, -100)
t.pendown()
t.seth(270)
t.color("black", "black")
t.begin_fill()
t.forward(30)
t.right(90)
t.forward(40)
t.seth(20)
t.circle(10, -225)
t.circle(400, -3)
t.seth(90)
t.forward(21)
t.goto(-4, -100)
t.end_fill()
t.penup()
t.goto(-100, 50)
t.pendown()
t.seth(225)
t.color("black", "yellow")
t.begin_fill()
t.forward(40)
t.left(90)
t.forward(35)
t.seth(90)
t.forward(50)
t.end_fill()
t.penup()
t.goto(100, 50)
t.pendown()
t.seth(315)
t.color("black", "yellow")
t.begin_fill()
t.forward(40)
t.right(90)
t.forward(36)
t.seth(90)
t.forward(50)
t.end_fill()
t.penup()
t.goto(0, -100)
t.pendown()
t.forward(30)
t.penup()
t.goto(0, -20)
t.pendown()
t.color("yellow")
t.begin_fill()
t.seth(45)
t.forward(20)
t.circle(10, 180)
t.right(90)
t.circle(10, 180)
t.forward(20)
t.end_fill()
t.penup()
t.color("black")
t.goto(-100, -20)
t.pendown()
t.circle(30, 90)
t.penup()
t.goto(100, -20)
t.pendown()
t.circle(30, -90)
t.penup()
t.goto(2, 300)
t.pendown()
t.begin_fill()
t.seth(135)
t.circle(100, 40)
t.end_fill()
t.penup()
t.goto(2, 300)
t.pendown()
t.begin_fill()
t.seth(45)
t.circle(100, 40)
t.end_fill()

二、画小猪佩奇

小猪佩奇大家都很熟悉,它是由国人阿斯特利(Astley)、贝克(Baker)、戴维斯(Davis)创作、导演和制作的一部英国学前电视动画片,小猪佩奇头用椭圆形,下半身用直线,代码展示:

import turtle as t

t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255, 155, 192), "pink")
t.setup(840, 500)
t.speed(10)

#鼻子
t.pu()
t.goto(-100, 100)
t.pd()
t.seth(-30)
t.begin_fill()
a = 0.4
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a+0.08
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a-0.08
        t.lt(3)
        t.fd(a)
t.end_fill()

t.pu()
t.seth(90)
t.fd(25)
t.seth(0)
t.fd(10)
t.pd()
t.pencolor(255, 155, 192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160, 82, 45)
t.end_fill()

t.pu()
t.seth(0)
t.fd(20)
t.pd()
t.pencolor(255, 155, 192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160, 82, 45)
t.end_fill()

#头
t.color((255, 155, 192), "pink")
t.pu()
t.seth(90)
t.fd(41)
t.seth(0)
t.fd(0)
t.pd()
t.begin_fill()
t.seth(180)
t.circle(300, -30)
t.circle(100, -60)
t.circle(80, -100)
t.circle(150, -20)
t.circle(60, -95)
t.seth(161)
t.circle(-300, 15)
t.pu()
t.goto(-100, 100)
t.pd()
t.seth(-30)
a = 0.4
for i in range(60):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a+0.08
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a-0.08
        t.lt(3)
        t.fd(a)
t.end_fill()

#耳朵
t.color((255, 155, 192), "pink")
t.pu()
t.seth(90)
t.fd(-7)
t.seth(0)
t.fd(70)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50, 50)
t.circle(-10, 120)
t.circle(-50, 54)
t.end_fill()

t.pu()
t.seth(90)
t.fd(-12)
t.seth(0)
t.fd(30)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50, 50)
t.circle(-10, 120)
t.circle(-50, 56)
t.end_fill()

#眼睛
t.color((255, 155, 192), "white")
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-95)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()

t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()

t.color((255, 155, 192), "white")
t.pu()
t.seth(90)
t.fd(-25)
t.seth(0)
t.fd(40)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()

t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()

#腮
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(-95)
t.seth(0)
t.fd(65)
t.pd()
t.begin_fill()
t.circle(30)
t.end_fill()

#嘴
t.color(239, 69, 19)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(-100)
t.pd()
t.seth(-80)
t.circle(30, 40)
t.circle(40, 80)

#身体
t.color("red", (255, 99, 71))
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-78)
t.pd()
t.begin_fill()
t.seth(-130)
t.circle(100, 10)
t.circle(300, 30)
t.seth(0)
t.fd(230)
t.seth(90)
t.circle(300, 30)
t.circle(100, 3)
t.color((255, 155, 192), (255, 100, 100))
t.seth(-135)
t.circle(-80, 63)
t.circle(-150, 24)
t.end_fill()

#手
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(-40)
t.seth(0)
t.fd(-27)
t.pd()
t.seth(-160)
t.circle(300, 15)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-10)
t.circle(-20, 90)

t.pu()
t.seth(90)
t.fd(30)
t.seth(0)
t.fd(237)
t.pd()
t.seth(-20)
t.circle(-300, 15)
t.pu()
t.seth(90)
t.fd(20)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-170)
t.circle(20, 90)

#脚
t.pensize(10)
t.color((240, 128, 128))
t.pu()
t.seth(90)
t.fd(-75)
t.seth(0)
t.fd(-180)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)

t.pensize(10)
t.color((240, 128, 128))
t.pu()
t.seth(90)
t.fd(40)
t.seth(0)
t.fd(90)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)

#尾巴
t.pensize(4)
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(70)
t.seth(0)
t.fd(95)
t.pd()
t.seth(0)
t.circle(70, 20)
t.circle(10, 330)
t.circle(70, 30)

三、画蜘蛛侠

蜘蛛侠是漫威漫画里的人物,画这个只需要掌握circle()和画曲线即可,代码:

from turtle import *
bgcolor("#990000")
pensize(10)
penup()
goto(0, 50)
pendown()
circle(-120)
penup()
circle(-120, -60)
pendown()
pensize(5)
right(50)
circle(70, 55)
right(85)
circle(75, 58)
right(90)
circle(70, 55)
right(90)
circle(70, 58)
penup()
pensize(10)
goto(80, 15)
pendown()
seth(92)
fd(135)
seth(125)
circle(30, 135)
seth(190)
fd(50)
seth(125)
circle(30, 135)
seth(275)
fd(90)
penup()
pensize(10)
goto(92, -150)
seth(240)
pendown()
fd(80)
left(10)
circle(-28, 185)
penup()
goto(0, 50)
seth(0)
pensize(10)
circle(-120, -60)
seth(200)
pendown()
fd(72)
left(20)
circle(30, 150)
left(20)
fd(20)
right(15)
fd(10)
pensize(5)
fillcolor("#3366cc")
begin_fill()
seth(92)
circle(-120, 31)
seth(200)
fd(45)
left(90)
fd(52)
end_fill()
fd(-12)
right(90)
fd(40)
penup()
right(90)
fd(18)
pendown()
right(86)
fd(40)
penup()
goto(-152, -86)
pendown()
left(40)
circle(35, 90)
penup()
goto(-80, 116)
seth(10)
pensize(5)
pendown()
begin_fill()
fillcolor("#3366cc")
fd(155)
seth(-88)
fd(37)
seth(195)
fd(156)
end_fill()
penup()
goto(-75, 38)
seth(15)
pendown()
begin_fill()
fd(158)
seth(-88)
fd(55)
seth(140)
circle(120, 78)
end_fill()
penup()
fillcolor("#3366cc")
pensize(5)
goto(75, -170)
pendown()
begin_fill()
seth(240)
fd(30)
right(90)
fd(17)
end_fill()
fd(10)
left(80)
fd(55)
penup()
left(90)
fd(15)
pendown()
left(85)
fd(55)
penup()
goto(43, -225)
left(84)
pendown()
circle(60, 51)
for i in range(3):
    penup()
    goto(-70+i*15, 135)
    seth(-90)
    pendown()
    pensize(5)
    fd(15-2*i)
for i in range(3):
    penup()
    goto(36 + i * 15, 156)
    seth(-90)
    pendown()
    pensize(5)
    fd(15 - 2 * i)
    a = -60
    b = 70
for i in range(4):
    penup()
    goto(a, b)
    a = a+40
    b = b+10
    seth(-90)
    pendown()
    pensize(5)
    fd(26)


def oo(li, jing):
    penup()
    goto(0, 50)
    seth(0)
    circle(-120, li)
    pendown()
    right(jing)


pensize(5)
oo(-60, 110)
fd(130)
oo(-28, 96)
fd(140)
oo(9, 89)
fd(144)
oo(42, 70)
fd(160)
oo(80, 60)
fd(130)
penup()
goto(-80, -40)
right(160)
pendown()
right(50)
circle(70, 45)
right(75)
circle(70, 38)
right(50)
circle(70, 45)
right(90)
circle(70, 48)
penup()
goto(-53, -70)
pendown()
left(40)
circle(70, 30)
right(50)
circle(70, 20)
right(50)
circle(70, 38)
right(70)
circle(70, 24)
penup()
goto(-19, -105)
left(72)
pendown()
fd(22)
right(60)
fd(22)
oo(-140, 80)
circle(-90, 120)
penup()
oo(140, 100)
circle(90, 13)
pendown()
right(-50)
circle(70, 45)
right(75)
circle(70, 38)
right(50)
circle(70, 36)
penup()
goto(22, -185)
right(70)
pendown()
fd(72)
penup()
goto(-40, -182)
right(38)
pendown()
fd(70)
penup()
pensize(7)
goto(-15, -110)
seth(0)
pendown()
pensize(10)
begin_fill()
left(130)
fd(110)
right(250)
circle(90, 60)
circle(40, 120)
fillcolor("#F5FFFA")
end_fill()
penup()
goto(5, -110)
pendown()
begin_fill()
right(30)
fd(110)
right(-250)
circle(-90, 60)
circle(-40, 120)
end_fill()
done()

总结:

这些内容,主要用了circle()画圆的方法,画出了小黄人,小猪佩奇和蜘蛛侠这三种形象。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐