五角星绘制

import math
import turtle

RADIUS = 100

angleSin18 = math.sin(math.pi * 0.1) * RADIUS
angleCos18 = math.cos(math.pi * 0.1) * RADIUS
angleSin54 = math.sin(math.pi * 0.3) * RADIUS
angleCos54 = math.cos(math.pi * 0.3) * RADIUS

turtle.width(1)

turtle.fillcolor("red")
turtle.begin_fill()
turtle.penup()
turtle.goto(-angleCos18, angleSin18)
turtle.pendown()

turtle.goto(angleCos18, angleSin18)

turtle.goto(-angleCos54, -angleSin54)

turtle.goto(0, RADIUS)

turtle.goto(angleCos54, -angleSin54)

turtle.goto(-angleCos18, angleSin18)
turtle.end_fill()

turtle.hideturtle()
turtle.penup()
turtle.back(200)
turtle.write("张锡华\n\n", align="center", font=("楷体", 30, "bold"))


turtle.done()

posted @ 2020-09-15 19:22  zxihua  阅读(69)  评论(0)    收藏  举报