网站首页 > 技术文章 正文
今天在电脑中又翻出几个更加酷炫的图形,这里分享给大家。
1 画蝴蝶
from turtle import *
from math import sin,cos,e
def draw():
cycle=25
t=0
while not (t>cycle*360):
p=e**cos(t)-2*cos(4*t)+sin(t/12)**5
x=a*sin(t)*p
y=b*cos(t)*p
goto(x,y)
dot()
t+=1
print(t)
bgcolor('lightyellow')
pencolor("red")
pu()
speed(0)
tracer(1000)
a=b=40
draw()
ht()
done()
2 turtle画酷炫图形 2
from turtle import *
import colorsys
speed(0)
bgcolor('black')
tracer(5)
width(2)
h=0.001
for i in range(360):
color(colorsys.hsv_to_rgb(h,1,1))
forward(100)
left(60)
forward(100)
right(120)
circle(50)
left(240)
forward(100)
left(60)
forward(100)
h+=0.02
color(colorsys.hsv_to_rgb(h,1,1))
forward(100)
right(60)
forward(100)
right(60)
forward(100)
left(120)
circle(-50)
right(240)
forward(100)
right(60)
forward(100)
left(2)
h+=0.02
done()
3 turtle画酷炫图形3
import turtle
turtle.reset()
turtle.hideturtle()
turtle.speed(0)
turtle.bgcolor('black')
c = 0
x = 0
colors = [
#reddish colors
(1.00, 0.00, 0.00),(1.00, 0.03, 0.00),(1.00, 0.05, 0.00),(1.00, 0.07, 0.00),(1.00, 0.10, 0.00),(1.00, 0.12, 0.00),(1.00, 0.15, 0.00),(1.00, 0.17, 0.00),(1.00, 0.20, 0.00),(1.00, 0.23, 0.00),(1.00, 0.25, 0.00),(1.00, 0.28, 0.00),(1.00, 0.30, 0.00),(1.00, 0.33, 0.00),(1.00, 0.35, 0.00),(1.00, 0.38, 0.00),(1.00, 0.40, 0.00),(1.00, 0.42, 0.00),(1.00, 0.45, 0.00),(1.00, 0.47, 0.00),
#orangey colors
(1.00, 0.50, 0.00),(1.00, 0.53, 0.00),(1.00, 0.55, 0.00),(1.00, 0.57, 0.00),(1.00, 0.60, 0.00),(1.00, 0.62, 0.00),(1.00, 0.65, 0.00),(1.00, 0.68, 0.00),(1.00, 0.70, 0.00),(1.00, 0.72, 0.00),(1.00, 0.75, 0.00),(1.00, 0.78, 0.00),(1.00, 0.80, 0.00),(1.00, 0.82, 0.00),(1.00, 0.85, 0.00),(1.00, 0.88, 0.00),(1.00, 0.90, 0.00),(1.00, 0.93, 0.00),(1.00, 0.95, 0.00),(1.00, 0.97, 0.00),
#yellowy colors
(1.00, 1.00, 0.00),(0.95, 1.00, 0.00),(0.90, 1.00, 0.00),(0.85, 1.00, 0.00),(0.80, 1.00, 0.00),(0.75, 1.00, 0.00),(0.70, 1.00, 0.00),(0.65, 1.00, 0.00),(0.60, 1.00, 0.00),(0.55, 1.00, 0.00),(0.50, 1.00, 0.00),(0.45, 1.00, 0.00),(0.40, 1.00, 0.00),(0.35, 1.00, 0.00),(0.30, 1.00, 0.00),(0.25, 1.00, 0.00),(0.20, 1.00, 0.00),(0.15, 1.00, 0.00),(0.10, 1.00, 0.00),(0.05, 1.00, 0.00),
#greenish colors
(0.00, 1.00, 0.00),(0.00, 0.95, 0.05),(0.00, 0.90, 0.10),(0.00, 0.85, 0.15),(0.00, 0.80, 0.20),(0.00, 0.75, 0.25),(0.00, 0.70, 0.30),(0.00, 0.65, 0.35),(0.00, 0.60, 0.40),(0.00, 0.55, 0.45),(0.00, 0.50, 0.50),(0.00, 0.45, 0.55),(0.00, 0.40, 0.60),(0.00, 0.35, 0.65),(0.00, 0.30, 0.70),(0.00, 0.25, 0.75),(0.00, 0.20, 0.80),(0.00, 0.15, 0.85),(0.00, 0.10, 0.90),(0.00, 0.05, 0.95),
#blueish colors
(0.00, 0.00, 1.00),(0.05, 0.00, 1.00),(0.10, 0.00, 1.00),(0.15, 0.00, 1.00),(0.20, 0.00, 1.00),(0.25, 0.00, 1.00),(0.30, 0.00, 1.00),(0.35, 0.00, 1.00),(0.40, 0.00, 1.00),(0.45, 0.00, 1.00),(0.50, 0.00, 1.00),(0.55, 0.00, 1.00),(0.60, 0.00, 1.00),(0.65, 0.00, 1.00),(0.70, 0.00, 1.00),(0.75, 0.00, 1.00),(0.80, 0.00, 1.00),(0.85, 0.00, 1.00),(0.90, 0.00, 1.00),(0.95, 0.00, 1.00)
]
while x < 1000:
idx = int(c)
color = colors[idx]
turtle.color(color)
turtle.forward(x)
turtle.right(98)
x = x + 1
c = c + 0.1
turtle.done()
4 turtle画酷炫图形4
import turtle as tur
import colorsys as cs
# tur.setsetup(800,800)
tur.speed(0)
tur.width(2)
tur.bgcolor('black')
for j in range(25):
for i in range(15):
tur.color(cs.hsv_to_rgb(1/25,j/25,1))
tur.right(90)
tur.circle(200-j*4,90)
tur.left(90)
tur.circle(200-j*4,90)
tur.right(180)
tur.circle(50,24)
tur.hideturtle()
tur.done()
猜你喜欢
- 2025-05-10 2023最新!210个Python练习案例附源码(百看不如一练)
- 2025-05-10 说Python基础差的同学,请疯狂啃-247个Python实战案例
- 2025-05-10 python学习方法很重要,整整400集教程(视频+源码+配套练习)
- 2025-05-10 Python 基础编程题100例(python经典编程题和答案)
- 2025-05-10 Python基础不扎实?这100道题帮你查漏补缺,快速提升编程能力!
- 2025-05-10 python入门-day20:综合练习(python基础训练100题)
- 2025-05-10 值得学习练手的70个Python项目(附代码),太实用了
- 2025-05-10 100道python练习题,献给嗜学如狂的人,疯狂白嫖
- 2025-05-10 如何用Python快速实现AI模型训练(python做模型)
- 2025-05-10 Python编程绝对初学者指南,一步一步的指南,有示例和实验练习
- 258℃Python短文,Python中的嵌套条件语句(六)
- 258℃python笔记:for循环嵌套。end=""的作用,图形打印
- 257℃PythonNet:实现Python与.Net代码相互调用!
- 252℃Python操作Sqlserver数据库(多库同时异步执行:增删改查)
- 252℃Python实现字符串小写转大写并写入文件
- 108℃原来2025是完美的平方年,一起探索六种平方的算吧
- 91℃Python 和 JavaScript 终于联姻了!PythonMonkey 要火?
- 83℃Ollama v0.4.5-v0.4.7 更新集合:Ollama Python 库改进、新模型支持
- 最近发表
- 标签列表
-
- python中类 (31)
- python 迭代 (34)
- python 小写 (35)
- python怎么输出 (33)
- python 日志 (35)
- python语音 (31)
- python 工程师 (34)
- python3 安装 (31)
- python音乐 (31)
- 安卓 python (32)
- python 小游戏 (32)
- python 安卓 (31)
- python聚类 (34)
- python向量 (31)
- python大全 (31)
- python次方 (33)
- python桌面 (32)
- python总结 (34)
- python浏览器 (32)
- python 请求 (32)
- python 前端 (32)
- python验证码 (33)
- python 题目 (32)
- python 文件写 (33)
- python中的用法 (32)