Python画动漫人物(1)

1.蜡笔小新

《蜡笔小新》是由日本漫画家臼井仪人创作的漫画,主要采用画椭圆的方法。

上代码:

import turtle as t

t.setup(800, 500)
t.pensize(2)
t.colormode(255)
t.speed(5)
t.color('black', (255, 228, 181))
t.shape('turtle')
t.speed(5)
t.showturtle()
t.pu()
t.goto(-150, 10)
t.pd()
t.seth(0)
t.begin_fill()
t.left(135)
t.circle(-70, 85)
t.right(8)
t.circle(-85, 44)
t.left(10)
t.circle(40, 61)
t.right(15)
t.fd(20)
t.right(5)
t.circle(-40, 45)
t.left(6)
t.circle(-70, 25)
t.left(18)
t.circle(-80, 35)
t.left(10)
t.circle(-70, 27)
t.circle(-120, 54)
t.pu()
t.goto(82, 30)
t.pd()
t.left(140)
t.fd(20)
t.right(10)
t.circle(-20, 65)
t.seth(-50)
t.fd(5)
t.right(13)
t.circle(-50, 50)
t.right(10)
t.circle(-60, 25)
t.right(7)
t.circle(-50, 20)
t.circle(-10, 90)
t.pu()
t.goto(-150, 10)
t.pd()
t.color('black', (255, 228, 181))
t.right(130)
t.circle(90, 33)
t.right(16)
t.circle(370, 28)
t.end_fill()
t.color('black', 'black')
t.pu()
t.goto(-18, 180)
t.pd()
t.begin_fill()
t.right(30)
t.circle(-350, 19)
t.right(38)
t.circle(-300, 17)
t.left(135)
t.fd(23)
t.left(39)
t.circle(120, 63)
t.left(10)
t.circle(110, 28)
t.right(11)
t.circle(85, 14)
t.end_fill()
t.pu()
t.goto(-52, 151)
t.pd()
t.begin_fill()
t.right(205)
t.circle(110, 33)
t.circle(7, 130)
t.left(50)
t.circle(-110, 30)
t.circle(8, 140)
t.end_fill()
t.pu()
t.goto(48, 140)
t.pd()
t.begin_fill()
t.right(4)
t.circle(150, 18)
t.right(4)
t.circle(-6, 140)
t.right(28)
t.circle(-150, 19)
t.right(10)
t.circle(-10, 150)
t.end_fill()
t.pu()
t.goto(-69, 126)
t.pd()
t.left(70)
t.circle(-80, 37)
t.right(15)
t.circle(-25, 100)
t.pu()
t.goto(2, 91)
t.pd()
t.left(150)
t.circle(-70, 30)
t.right(10)
t.circle(-40, 60)
t.circle(-70, 20)
t.pu()
t.goto(-60, 110)
t.pd()
t.begin_fill()
t.right(52)
t.circle(27)
t.end_fill()
t.color('black', 'white')
t.pu()
t.goto(-45, 110)
t.pd()
t.begin_fill()
t.right(24)
t.circle(20, 80)
t.circle(7, 100)
t.seth(40)
t.fd(22)
t.left(17)
t.circle(10, 155)
t.end_fill()
t.pu()
t.goto(-20, 95)
t.pd()
t.begin_fill()
t.left(70)
t.circle(-14, 80)
t.circle(-7, 120)
t.right(44)
t.circle(35, 30)
t.end_fill()
t.pu()
t.goto(-41, 77)
t.pd()
t.begin_fill()
t.left(28)
t.circle(6)
t.end_fill()
t.color('black', 'black')
t.pu()
t.goto(-5, 55)
t.pd()
t.begin_fill()
t.left(10)
t.circle(-25)
t.end_fill()
t.color('black', 'white')
t.pu()
t.goto(5, 57)
t.pd()
t.begin_fill()
t.left(40)
t.circle(-8, 120)
t.left(30)
t.circle(-19, 80)
t.circle(-8, 120)
t.right(32)
t.circle(19, 60)
t.right(55)
t.circle(-9, 95)
t.end_fill()
t.pu()
t.goto(38, 62)
t.pd()
t.begin_fill()
t.left(190)
t.circle(-15, 50)
t.circle(-8, 100)
t.right(40)
t.circle(-10, 80)
t.end_fill()
t.pu()
t.goto(10, 50)
t.pd()
t.begin_fill()
t.circle(-5)
t.end_fill()
t.pu()
t.goto(-129, 12)
t.pd()
t.circle(-40, 35)
t.color('black', (205, 32, 32))
t.pu()
t.goto(-142, 7)
t.pd()
t.begin_fill()
t.seth(-150)
t.fd(18)
t.seth(150)
t.fd(55)
t.left(105)
t.circle(-43, 40)
t.right(125)
t.circle(-43, 30)
t.left(180)
t.circle(43, 30)
t.seth(-50)
t.fd(46)
t.circle(50, 26)
t.left(27)
t.circle(60, 50)
t.right(180)
t.circle(100, 60)
t.seth(0)
t.fd(194)
t.left(120)
t.circle(-50, 50)
t.fd(25)
t.right(20)
t.circle(34, 66)
t.circle(18, 116)
t.right(30)
t.circle(-90, 18)
t.seth(135)
t.fd(12)
t.seth(-145)
t.fd(10)
t.right(46)
t.circle(-90, 20)
t.circle(10, 100)
t.circle(-60, 20)
t.right(130)
t.circle(-50, 20)
t.left(90)
t.circle(-370, 6)
t.left(15)
t.circle(-90, 13)
t.right(7)
t.circle(-90, 18)
t.end_fill()
t.pu()
t.goto(-64, -33)
t.pd()
t.left(160)
t.circle(100, 40)
t.circle(40, 40)
t.color('black', (255, 228, 181))
t.pu()
t.goto(-62, -28)
t.pd()
t.begin_fill()
t.seth(140)
t.fd(8)
t.left(77)
t.circle(-12, 150)
t.left(90)
t.fd(11)
t.circle(-4, 120)
t.right(45)
t.fd(11)
t.left(130)
t.circle(20, 35)
t.circle(-4, 140)
t.right(30)
t.circle(-20, 40)
t.left(160)
t.circle(20, 40)
t.circle(-4, 140)
t.right(20)
t.circle(-20, 50)
t.left(190)
t.circle(-20, 40)
t.circle(-3, 130)
t.left(5)
t.circle(-20, 60)
t.left(180)
t.circle(-20, 40)
t.seth(25)
t.fd(10)
t.left(240)
t.circle(-30, 30)
t.left(40)
t.circle(60, 20)
t.seth(-30)
t.fd(7)
t.seth(-125)
t.fd(25)
t.end_fill()
t.pu()
t.goto(-212, 3)
t.pd()
t.begin_fill()
t.seth(150)
t.fd(12)
t.left(90)
t.fd(8)
t.right(50)
t.circle(-9, 90)
t.left(110)
t.fd(14)
t.right(40)
t.circle(-4, 120)
t.right(15)
t.circle(-20, 40)
t.left(180)
t.circle(-3, 100)
t.left(123)
t.circle(-30, 30)
t.circle(-3, 150)
t.right(10)
t.circle(-30, 30)
t.seth(80)
t.fd(3)
t.left(72)
t.circle(30, 30)
t.right(8)
t.circle(-4, 120)
t.right(43)
t.circle(-30, 40)
t.seth(80)
t.fd(3)
t.left(70)
t.circle(30, 34)
t.right(17)
t.circle(-4, 120)
t.right(27)
t.circle(-20, 90)
t.left(180)
t.circle(-20, 50)
t.seth(35)
t.fd(8)
t.left(234)
t.circle(60, 20)
t.seth(-33)
t.circle(-50, 23)
t.seth(-119)
t.fd(16)
t.end_fill()

2.海绵宝宝

《海绵宝宝》(SpongeBob SquarePants)是一部由舍曼·科恩、沃特·杜赫、山姆·亨德森、保罗·蒂比特、沃尔特·道恩 等导演,汤姆·肯尼、比尔·法格巴克、罗杰·布帕斯等配音的美国喜剧动画,于1999年7月17日在尼克国际儿童频道开播 ,用circle()就能做出来。

代码展示:

from turtle import *



def go_to(x, y):
    penup()
    goto(x, y)
    pendown()
def help_do():
    go_to(-400, 0)
    forward(800)
    go_to(-400, 100)
    forward(800)
    go_to(-400, 200)
    forward(800)
    go_to(-400, -100)
    forward(800)
    go_to(-400, -200)
    forward(800)
    left(90)
    go_to(0, -300)
    forward(600)
    go_to(100, -300)
    forward(600)
    go_to(-100, -300)
    forward(600)
    go_to(-200, -300)
    forward(600)
    go_to(200, -300)
    forward(600)
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()
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 hole():
    go_to(-160, 160)
    circle(30, 360)
def face():
    eye()
    nose()
    mouth()
    tooth()
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()
def spongeBob():
    head()
    face()
    body()
    tie()
if __name__ == '__main__':
    screensize(800, 600, 'white')
    pensize(3)
    speed(10)
    go_to(0, 0)
    spongeBob()
    go_to(-100, 240)
    write('海绵宝宝', font=('BRUSHSCI.TTF', '30', 'bold'))
    mainloop()

3.哆啦A梦

《哆啦A梦》是日本漫画家藤本弘(笔名藤子·F·不二雄)创作的漫画,同样用椭圆,circle()就能做出来。

代码:

from turtle import*


def my_goto(x, y):
    penup()
    goto(x, y)
    pendown()


def eyes():
    fillcolor("#ffffff")
    begin_fill()
    a = 2.5
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a -= 0.05
            lt(3)
            fd(a)
        else:
            a += 0.05
            lt(3)
            fd(a)
    end_fill()


def beard():
    my_goto(-32, 135)
    seth(165)
    fd(60)
    my_goto(-32, 125)
    seth(180)
    fd(60)
    my_goto(-32, 115)
    seth(193)
    fd(60)
    my_goto(37, 135)
    seth(15)
    fd(60)
    my_goto(37, 125)
    seth(0)
    fd(60)
    my_goto(37, 115)
    seth(-13)
    fd(60)


def mouth():
    my_goto(5, 148)
    seth(270)
    fd(100)
    seth(0)
    circle(120, 50)
    seth(230)
    circle(-120, 100)


def scarf():
    fillcolor('#e70010')
    begin_fill()
    seth(0)
    fd(200)
    circle(-5, 90)
    fd(10)
    circle(-5, 90)
    fd(207)
    circle(-5, 90)
    fd(10)
    circle(-5, 90)
    end_fill()


def nose():
    my_goto(-10, 158)
    seth(315)
    fillcolor('#e70010')
    begin_fill()
    circle(20)
    end_fill()


def black_eyes():
    seth(0)
    my_goto(-20, 195)
    fillcolor('#000000')
    begin_fill()
    circle(13)
    end_fill()
    pensize(6)
    my_goto(20, 205)
    seth(75)
    circle(-10, 150)
    pensize(3)
    my_goto(-17, 200)
    seth(0)
    fillcolor('#ffffff')
    begin_fill()
    circle(5)
    end_fill()
    my_goto(0, 0)


def face():
    fd(183)
    lt(45)
    fillcolor('#ffffff')
    begin_fill()
    circle(120, 100)
    seth(180)
    fd(121)
    pendown()
    seth(215)
    circle(120, 100)
    end_fill()
    my_goto(63.56, 218.24)
    seth(90)
    eyes()
    seth(180)
    penup()
    fd(60)
    pendown()
    seth(90)
    eyes()
    penup()
    seth(180)
    fd(64)


def head():
    penup()
    circle(150, 40)
    pendown()
    fillcolor('#00a0de')
    begin_fill()
    circle(150, 280)
    end_fill()


def Doraemon():
    head()
    scarf()
    face()
    black_eyes()
    nose()
    mouth()
    my_goto(0, 0)
    seth(0)
    penup()
    circle(150, 50)
    pendown()
    seth(30)
    fd(40)
    seth(70)
    circle(-30, 270)
    fillcolor('#00a0de')
    begin_fill()
    seth(230)
    fd(80)
    seth(90)
    circle(1000, 1)
    seth(-89)
    circle(-1000, 10)
    seth(180)
    fd(70)
    seth(90)
    circle(30, 180)
    seth(180)
    fd(70)
    seth(100)
    circle(-1000, 9)
    seth(-86)
    circle(1000, 2)
    seth(230)
    fd(40)
    circle(-30, 230)
    seth(45)
    fd(81)
    seth(0)
    fd(203)
    circle(5, 90)
    fd(10)
    circle(5, 90)
    fd(7)
    seth(40)
    circle(150, 10)
    seth(30)
    fd(40)
    end_fill()
    seth(70)
    fillcolor('#ffffff')
    begin_fill()
    circle(-30)
    end_fill()
    my_goto(103.74, -182.59)
    seth(0)
    fillcolor('#ffffff')
    begin_fill()
    fd(15)
    circle(-15, 180)
    fd(90)
    circle(-15, 180)
    fd(10)
    end_fill()
    my_goto(-96.26, -182.59)
    seth(180)
    begin_fill()
    circle(15, 180)
    fd(90)
    circle(15, 180)
    fd(10)
    end_fill()
    my_goto(-133.97, -91.81)
    seth(50)
    begin_fill()
    circle(30)
    end_fill()
    my_goto(-103.42, 15.09)
    seth(0)
    fd(38)
    seth(230)
    begin_fill()
    circle(90, 260)
    end_fill()
    my_goto(5, -40)
    seth(0)
    fd(70)
    seth(-90)
    circle(-70, 180)
    seth(0)
    fd(70)
    my_goto(-103.42, 15.09)
    fd(90)
    seth(70)
    fillcolor('#ffd200')
    begin_fill()
    circle(-20)
    end_fill()
    seth(170)
    begin_fill()
    circle(-2, 180)
    seth(10)
    circle(-100, 22)
    circle(-2, 180)
    seth(180-10)
    circle(100, 22)
    end_fill()
    goto(-13.42, 15.09)
    seth(250)
    circle(20, 110)
    seth(90)
    fd(15)
    dot(10)
    my_goto(0, -150)


if __name__ == '__main__':
    pensize(3)
    speed(7)
    Doraemon()
    my_goto(100, -300)
    mainloop()

今天就分享这三种,下次再说~~~~~

你可能感兴趣的:(Python,python)