python画原神魈代码
时间: 2023-11-08 20:03:54 浏览: 304
以下是 Python 代码,用于绘制原神中的魈:
```python
import turtle
# 设置画布大小和背景色
turtle.setup(800, 600)
turtle.bgcolor('black')
# 魈的轮廓
turtle.pensize(3)
turtle.penup()
turtle.goto(-200, 0)
turtle.pendown()
turtle.color('#D7B98E')
turtle.circle(80, 180)
turtle.circle(140, 180)
turtle.circle(80, 180)
# 魈的眼睛
turtle.penup()
turtle.goto(-80, 80)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(-70, 80)
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(15)
turtle.end_fill()
# 魈的嘴巴
turtle.penup()
turtle.goto(-40, 40)
turtle.pendown()
turtle.setheading(315)
turtle.circle(50, 90)
turtle.penup()
turtle.goto(-40, 40)
turtle.setheading(225)
turtle.pendown()
turtle.circle(50, 90)
# 魈的鼻子
turtle.penup()
turtle.goto(-50, 60)
turtle.pendown()
turtle.fillcolor('#D7B98E')
turtle.begin_fill()
for i in range(5):
turtle.forward(20)
turtle.right(144)
turtle.end_fill()
# 魈的红色装饰
turtle.penup()
turtle.goto(-160, -10)
turtle.pendown()
turtle.setheading(45)
turtle.color('#C23531')
for i in range(4):
turtle.forward(80)
turtle.right(90)
turtle.penup()
turtle.goto(-150, -10)
turtle.setheading(45)
turtle.pendown()
for i in range(4):
turtle.forward(60)
turtle.right(90)
# 魈的黄色装饰
turtle.penup()
turtle.goto(30, -10)
turtle.pendown()
turtle.color('#F4D03F')
turtle.setheading(135)
for i in range(4):
turtle.forward(80)
turtle.right(90)
turtle.penup()
turtle.goto(40, -10)
turtle.setheading(135)
turtle.pendown()
for i in range(4):
turtle.forward(60)
turtle.right(90)
# 隐藏海龟
turtle.hideturtle()
# 显示绘图窗口
turtle.done()
```
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)