from turtle import *
from math import *
pencolor("pink") #画笔颜色
def draw(a,end):
t=0
while t<24*end:
x=a*sin(t)*(exp(cos(t))-2*cos(4*t)+pow(sin(t/12),5))
y=a*cos(t)*(exp(cos(t))-2*cos(4*t)+pow(sin(t/12),5))
goto(x,y)
t=t+0.05
if __name__ == '__main__':
draw(80,3.14)
1.2 绘制五角星
import turtle #导入画图模块
import time #导入时间模块
t = turtle.Turtle()
turtle.screensize(1000,1000) #定义画布大小
t.pensize(10) # 定义画笔的宽度
t.pencolor("yellow") # 定义画笔颜色
t.fillcolor("red") # 定义填充颜色
t.begin_fill() # 开始填充图像
for i in range(5): # 五角星循环五次
t.forward(500)
t.right(144) # 右转144°
t.end_fill() # 停止填充
time.sleep(2) # 阻塞两秒
————————————————
版权声明:本文为CSDN博主「Z小旋」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/as480133937/article/details/88592426
评论