Skip to content

Instantly share code, notes, and snippets.

@jsbueno
Created July 28, 2017 01:57
Show Gist options
  • Save jsbueno/a93d43aa56261cfc601792507b0c9fac to your computer and use it in GitHub Desktop.
Save jsbueno/a93d43aa56261cfc601792507b0c9fac to your computer and use it in GitHub Desktop.
Simple lissageous curves with pygame
from math import cos, sin
import pygame
tela = pygame.display.set_mode((640, 480))
CX, CY = 320, 240
def lissageous(m=1, n=1, st=0.1, total=10000):
counter = 0
t = 0
while counter < total:
x = int(CX + 0.8 * CX * cos(m * t))
y = int(CY + 0.8 * CY * sin(n * t))
tela.set_at((x, y), (0, 0, 0))
t += st; counter += 1
if not counter % 100:
pygame.display.flip()
pygame.display.flip()
tela.fill((255,255,255))
lissageous(7, 4)
while not pygame.key.get_pressed()[pygame.K_ESCAPE]:
pygame.time.delay(100)
pygame.event.pump()
pygame.quit()
@bybinhabr
Copy link

show!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment