Python turtle绘制你的情人节礼物
最新推荐文章于 2024-03-21 17:51:00 发布
原创 于 2023-02-14 11:28:03 发布 · 404 阅读
· 0
· 0 ·
CC 4.0 BY-SA版权
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
情人节
Valentine’s Day is coming。自己做一个礼物送给TA,诚意满满,走心还不费钱
在GitHub上扒下来一段Python代码,做个简单的礼物真是很简单呢
源码
#main.py from functions import xt, yt from turtle import * t = Turtle() t.speed(20) colormode(255) Screen().bgcolor((0, 0, 0)) for i in range(365): t.goto((xt(i) * 20, yt(i) * 20)) t.pencolor((255 - i) % 255, i % 255, (255 + i) // 2 % 255) t.goto(0, 0) t.penup() t.goto(-80, 250) t.hideturtle() t.write("love",font=("华文彩云",72)) update() done()
python
1234567891011121314151617181920#functions.py import math as m def xt(t): x = 16 * m.sin(t) ** 3 return x def yt(t): y = 13 * m.cos(t) - 5 * m.cos(2 * t) - 2 * m.cos(3 * t) - m.cos(4 * t) return y
python
123456789101112仅在原代码基础上多写了个“love”。
结果

引用
感谢GreatRaksin。
GreatRaksin /saintValentine_turtle
相关知识
情人节献礼:用Python turtle函数绘制动态玫瑰花
用python turtle绘制一朵玫瑰花
6年级Python入门:使用turtle模块绘制花朵图案
【Python实用工具】(情人节献礼)turtle函数绘制动态玫瑰花
python的turtle画个玫瑰花
python用turtle画玫瑰花
Python用turtle库绘制图形——漂亮的玫瑰
python turtle玫瑰花绘制效果和源代码
用python绘制玫瑰花的代码
python玫瑰花代码简单
原文链接: Python turtle绘制你的情人节礼物 https://m.huajiangbk.com/newsview2559404.html
| 上一篇: 相亲没确定关系怎么过情人节【婚礼... | 下一篇: 今年情人节,送TA一座“可移动的... |




