用Go或者c++或者python画一只动态的福兔
时间: 2023-04-11 13:01:08 浏览: 109
用python画一只可爱的兔子
我可以回答这个问题。你可以使用Python的turtle库来画一只动态的福兔。以下是一个简单的代码示例:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor('pink')
# 画兔子的身体
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.circle(100)
turtle.end_fill()
# 画兔子的耳朵
turtle.penup()
turtle.goto(-70, 150)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
turtle.penup()
turtle.goto(70, 150)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.left(45)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(135)
turtle.forward(140)
turtle.end_fill()
# 画兔子的眼睛和嘴巴
turtle.penup()
turtle.goto(-30, 50)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(30, 50)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.right(90)
turtle.circle(30, 180)
# 画兔子的脚
turtle.penup()
turtle.goto(-70, -100)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(70)
turtle.end_fill()
turtle.penup()
turtle.goto(70, -100)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.left(45)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(135)
turtle.forward(70)
turtle.end_fill()
# 画兔子的尾巴
turtle.penup()
turtle.goto(100, -20)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.right(45)
turtle.circle(30, 180)
turtle.right(90)
turtle.circle(30, 180)
turtle.end_fill()
# 动态效果
while True:
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.circle(100)
turtle.end_fill()
turtle.penup()
turtle.goto(-70, 150)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.right(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(140)
turtle.end_fill()
turtle.penup()
turtle.goto(70, 150)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.left(45)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(135)
turtle.forward(140)
turtle.end_fill()
turtle.penup()
turtle.goto(-30, 50)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(30, 50)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('black')
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.right(90)
turtle.circle(30, 180)
turtle.penup()
turtle.goto(-70, -100)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.right(45)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(135)
turtle.forward(70)
turtle.end_fill()
turtle.penup()
turtle.goto(70, -100)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('pink')
turtle.left(45)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(135)
turtle.forward(70)
turtle.end_fill()
turtle.penup()
turtle.goto(100, -20)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor('white')
turtle.right(45)
turtle.circle(30, 180)
turtle.right(90)
turtle.circle(30, 180)
turtle.end_fill()
turtle.right(10)
```
运行这个代码,你就可以看到一只动态的福兔了!
阅读全文