用Python画路飞骷髅图案【附代码】

 

用Python代码实现这幅图的绘制,由于学艺不精,只能用直角坐标系作为参考画出来。

配色的RGB取色色块

还有重要的量角器兄弟

下面是代码

#路飞骷髅
import turtle as t
#黄底帽子
t.pu()
t.goto(0,200)
t.circle(-130,-80)
t.pd()
t.colormode(255)
t.pensize(5)
t.color(242,232,184) #帽子黄底RGB
t.begin_fill()
t.pencolor(0,0,0)
t.circle(-130,160)
t.seth(180)
t.fd(255)
t.end_fill()

#红色线条
t.begin_fill()
t.color(221,65,43) #帽子红色带
t.pencolor(0,0,0)
t.seth(80)
t.circle(-130,19)
t.seth(0)
t.fd(225)
t.seth(-59)
t.circle(-130,19)
t.seth(180)
t.fd(255)
t.end_fill()

#帽檐
t.begin_fill()
t.color(242,232,184)
t.pencolor(0,0,0)
t.fd(60)
t.circle(12,180)
t.fd(375)
t.circle(12,180)
t.fd(255 + 60)
t.end_fill()

#脸部下半轮廓
t.pu()
t.setpos(0,-30)
t.seth(-180)
t.circle(-130,-75)
t.pd()
t.circle(-130,150)

#眼睛鼻子
t.pu()
t.color(33,24,24) #眼睛、鼻子RGB
t.setpos(-45,64)
t.seth(-180)
t.pd()
t.begin_fill()
t.circle(33)
t.pu()
t.setpos(45,64)
t.pd()
t.circle(33)
t.end_fill()

t.pu()
t.setpos(0,5)
t.pd()
t.begin_fill()
t.circle(8)
t.end_fill()

#下巴
t.pencolor(0,0,0)
t.pu()
t.setpos(0,0)
t.seth(0)
t.circle(-75,45)
t.pd()
t.circle(-75,270)

#牙齿
t.pu()
t.setpos(0,120)
t.seth(0)
t.circle(-105,136)
t.pd()
t.circle(-105,86)

t.pu()
t.seth(0)
t.goto(0,200)
t.circle(-130,150)
t.pd()
t.circle(-130,60)

t.pu() #牙齿三根竖线
t.setpos(-30,-27)
t.seth(260)
t.pd()
t.fd(52)
t.pu()
t.setpos(30,-27)
t.pd()
t.seth(-260)
t.fd(-52)
t.pu()
t.setpos(0,-30)
t.seth(-90)
t.pd()
t.fd(56)

#上排右侧小爪爪
#释放注释为:上排右侧小爪爪实心金方案
t.pu()
#t.color(255,215,0) #金色的RGB
t.pencolor(0,0,0)
t.setpos(110,145)
t.seth(45)
t.pd()
#t.begin_fill()
t.fd(40)
t.seth(135)
t.circle(-30,235)
t.seth(-20)
t.circle(-30,220)
t.seth(-135)
t.fd(40)
#t.end_fill()

#上排左侧小爪爪
t.pu()
t.pencolor(0,0,0)
t.setpos(-110,145)
t.seth(135)
t.pd()
t.fd(40)
t.seth(45)
t.circle(30,235)
t.seth(-160)
t.circle(30,220)
t.seth(-45)
t.fd(40)

#下排右侧小爪爪
t.pu()
t.setpos(70,-10)
t.seth(-45)
t.pd()
t.fd(70)
t.seth(45)
t.circle(-30,235)
t.seth(-70)
t.circle(-30,255)
t.seth(135)
t.fd(22)

#下排左侧小爪爪
t.pu()
t.setpos(-70,-10)
t.seth(-135)
t.pd()
t.fd(70)
t.seth(135)
t.circle(30,235)
t.seth(-110)
t.circle(30,255)
t.seth(45)
t.fd(22)

------------------------------------------------------

GitHub代码库

https://github.com/Yangjiajun1989/Luffy-bone

 

代码效果:

 

  • 27
    点赞
  • 92
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
可以使用 Python 的 turtle 模块来路飞,具体代码可以参考以下示例: import turtle # 设置笔 pen = turtle.Turtle() pen.speed(10) pen.pensize(5) # 路飞的帽子 pen.fillcolor("red") pen.begin_fill() pen.circle(100, 180) pen.goto(, ) pen.end_fill() # 路飞的脸 pen.fillcolor("yellow") pen.begin_fill() pen.circle(100) pen.end_fill() # 路飞的眼睛 pen.penup() pen.goto(-40, 120) pen.pendown() pen.fillcolor("white") pen.begin_fill() pen.circle(20) pen.end_fill() pen.penup() pen.goto(-30, 130) pen.pendown() pen.fillcolor("black") pen.begin_fill() pen.circle(10) pen.end_fill() pen.penup() pen.goto(40, 120) pen.pendown() pen.fillcolor("white") pen.begin_fill() pen.circle(20) pen.end_fill() pen.penup() pen.goto(30, 130) pen.pendown() pen.fillcolor("black") pen.begin_fill() pen.circle(10) pen.end_fill() # 路飞的嘴巴 pen.penup() pen.goto(-60, 80) pen.pendown() pen.right(45) pen.circle(80, 90) # 路飞的胡须 pen.penup() pen.goto(-80, 60) pen.pendown() pen.right(45) pen.forward(80) pen.penup() pen.goto(-80, 40) pen.pendown() pen.right(90) pen.forward(80) pen.penup() pen.goto(-80, 20) pen.pendown() pen.right(45) pen.forward(80) pen.penup() pen.goto(80, 60) pen.pendown() pen.left(90) pen.forward(80) pen.penup() pen.goto(80, 40) pen.pendown() pen.left(45) pen.forward(80) pen.penup() pen.goto(80, 20) pen.pendown() pen.left(90) pen.forward(80) # 路飞的眉毛 pen.penup() pen.goto(-60, 160) pen.pendown() pen.right(45) pen.forward(40) pen.penup() pen.goto(60, 160) pen.pendown() pen.left(90) pen.forward(40) # 完成图 turtle.done()

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值