Skip to content

Commit cca765e

Browse files
author
root
committed
Merge branch 'master' of git://github.com/acm-uiuc/chroma-scripts
2 parents a582fab + c9f3292 commit cca765e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

animations/waves/main.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@
44
from colorsys import hsv_to_rgb
55

66
speed = 40.0
7-
7+
light_count = 48
88
if __name__ == "__main__":
99
import time
1010
out = FadeAnimation()
11-
out.FADERATE = 1.0 # seconds
11+
out.FADERATE = 1.0 # seconds
1212
out.start()
1313

1414
counter = 0.0
1515

1616
while True:
17-
pix = [(0.0,0.0,0.0)]*24
17+
pix = [(0.0, 0.0, 0.0)] * light_count
1818
for i in range(4):
1919
for j in range(4):
20-
rgb = hsv_to_rgb((sin(radians(counter)/2.0+float(i)/6.0)+1.0)/2.0, 1.0, 1.0)
21-
pix[i*4+j] = (rgb[0]*1023.0, rgb[1]*1023.0, rgb[2]*1023.0)
20+
rgb = hsv_to_rgb(
21+
(sin(radians(counter) / 2.0 + float(i) / 6.0) + 1.0) / 2.0, 1.0, 1.0)
22+
pix[i * 4 + j] = (
23+
rgb[0] * 1023.0, rgb[1] * 1023.0, rgb[2] * 1023.0)
2224
out.write(pix)
23-
time.sleep(1.0/speed)
25+
time.sleep(1.0 / speed)
2426
counter += 0.8

0 commit comments

Comments
 (0)