赞
踩
import random
from math import sin,cos,pi,log
from tkinter import *
CANVAS_WIDTH = 640
CANVAS_HEIGHT = 640;
CANVAS_CENTER_X = CANVAS_WIDTH/2
CANVAS_CENTER_Y = CANVAS_HEIGHT/2
IMAGE_ENLARGE = 11
HEART_COLOR = "#ff7171"
def heart(t,shrink_ratio:float = IMAGE_ENLARGE):
x = 16 * (sin(t)**3)
y = -(13 * cos(t) - 5 * cos(2 * t) - 2 * cos(3*t)- cos(4 * t))
x *= shrink_ratio
y *= shrink_ratio
x += CANVAS_CENTER_X
y += CANVAS_CENTER_Y
return int(x),int(y)
def scatter(x,y,beta=0.15):
ratio_x = -beta * log(random.random())
ratio_y = -beta * log(random.random())
dx = ratio_x * (x - CANVAS_CENTER_X)
dy = ratio_y * (y - CANVAS_CEN
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。