猫史档案馆


【Python作品分享】新的作品【作品秀】

用户:小喵来了小喵来了查看:0 回复:0 评论:0 创建时间:2021-09-24T22:10:25


【作品展示】

center_image

 

【作品介绍】

差不多像视觉盛宴

 

【作品源代码】

import turtle as t
from itertools import cycle

colors = cycle(['red', 'orange', 'Goldenrod','yellow', 'green', \
               'Lawn Green', 'Light blue', 'blue', 'Thistle', 'purple', 'brown', 'Seashell'])

def draw_shape(size, angle, shift, shape, number, speed):
    t.speed(speed)
    t.pencolor(next(colors))
    next_shape = ''
    if shape == 'circle':
        t.circle(size)
        if number != 1: 
            next_shape = '喵'
        else:
            next_shape = 'circle'
    elif shape == '喵':
        for i in range(4):
            t.forward(size * 2)
            t.left(90)
        if number != 2:
            next_shape = 'triangles'
        else:
            next_shape = '喵'
    elif shape == 'triangles':
        for x in range(3):
            t.forward(size * 2)
            t.left(120)
            next_shape = 'circle'
    t.right(angle)
    t.forward(shift)
    draw_shape(size + 5, angle + 1, shift + 1, next_shape, number, speed)

t.pensize(4)
t.bgcolor('black')
draw_shape(30, 0, 1, 'circle', 1, 'fast')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页