Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up polygons example a bit more
- Loading branch information
Showing
2 changed files
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |