Skip to content

Commit

Permalink
cleaned up polygons example a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
kragen committed Sep 22, 2011
1 parent d19d38b commit e361932
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion notes
Expand Up @@ -53,8 +53,9 @@ Possible demos:
- rotating polygons
- klappquadrat
- a version of Artfall?
- some kind of harmonic synthesis?
- D some kind of harmonic synthesis?
- my wave-mechanics thing?
- translucent color circles drifting around

Shit. Compiling current (2009!) PyGame requires libsdl1.2-devel and
libsmpeg-devel, which has vanished from Ubuntu’s web site.
Expand Down
14 changes: 7 additions & 7 deletions polygons.py
@@ -1,22 +1,22 @@
#!/usr/bin/python
# basado en
# http://lists.canonical.org/pipermail/kragen-hacks/2008-January/000477.html
# lo cual es inspirado por Pedal (1995), por Dave Moore
from pygame import *
from math import pi, sin, cos

pantalla = display.set_mode((0, 0), FULLSCREEN)
ww, hh = pantalla.get_size()
color, d_d_theta, r = (255, 64, 64), pi/40, hh/2
d_theta = 0
theta, d_theta, r, color = 0, 0.04, hh/2, (255, 64, 64)

while event.poll().type not in (MOUSEBUTTONDOWN, QUIT):
d_theta += d_d_theta
theta += d_theta

puntos = [(ww/2 + sin(ii * d_theta) * r,
hh/2 - cos(ii * d_theta) * r)
for ii in range(3 + d_theta // (2 * pi))]
puntos = [(ww/2 + sin(ii * theta) * r, # x
hh/2 - cos(ii * theta) * r) # y
for ii in range(3 + theta // (2 * pi))]

pantalla.fill(0)
pantalla.fill(0) # llenar con negro
draw.polygon(pantalla, color, puntos)

display.flip()

0 comments on commit e361932

Please sign in to comment.