Вообще выкинул часть формул и вот что получилось.
import pygame
import sys
import random
pygame.init()
sc = pygame.display.set_mode((700, 700))
sc.fill((0, 0, 0))
color1 =(random.randint(0,255),random.randint(0,255),random.randint(0,255))
color2 =(random.randint(0,255),random.randint(0,255),random.randint(0,255))
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
pygame.image.save(sc, "image.jpg")
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
pygame.draw.circle(sc, color1, event.pos, 20)
x1 = 200
y1 = 200
x2 = 300
y2 = 300
x3 = 400
y3 = 400
for t in map(lambda x: x/100.0, range(0, 300, 1)):
p1 = 2*t*(1-t)*x2 +2*t*(1-t)*y2
p2 = (t*t)*x3 + (t*t)*y3
pygame.draw.circle(sc,(255,0,0), (p1,p2), 5)
pygame.display.update()
|