首页 > 解决方案 > 是否可以在不使用乌龟的情况下在 python 中绘制动画徽标或螺旋?

问题描述

在此处输入图像描述我想使用 python 代码绘制动画图或徽标,但不使用海龟。可能使用其他软件包为情节的片段设置动画。你能帮我为下面的图像制作动画吗?

from turtle import Screen, Turtle


RADIUS = 100

screen = Screen()
screen.colormode(255)

turtle = Turtle(visible=False)
turtle.speed('fastest')  # because I have no patience
turtle.penup()  # we'll use fill instead of lines
turtle.color(20, 191, 150)  # greenish color

turtle.sety(-RADIUS)  # center hexagon
turtle.begin_fill()
turtle.circle(RADIUS, steps=6)  # draw hexagon
turtle.end_fill()

turtle.color('white')  # interior color
turtle.sety(2 * RADIUS / 11)  # position circle (head)
turtle.begin_fill()
turtle.circle(2 * RADIUS / 9)  # draw circle (head)
turtle.end_fill()

turtle.forward(5 * RADIUS / 8)
turtle.right(85)

turtle.begin_fill()
turtle.circle(-13 * RADIUS / 20, 190)
turtle.right(85)
turtle.circle(-13 * RADIUS / 20, 90)
turtle.left(180)
turtle.circle(-13 * RADIUS / 20, 90)
turtle.end_fill()

screen.exitonclick()

以上代码由@cdlane 提供

标签: python-3.xalgorithmanimation

解决方案


推荐阅读