Skip to content

Commit

Permalink
Update some animations to 48 lights
Browse files Browse the repository at this point in the history
  • Loading branch information
milanocookies93 committed Jun 8, 2014
1 parent d365095 commit cf57c80
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions animations/cylon/main.py
Expand Up @@ -12,12 +12,12 @@
while True:
pix = []
alive = 0
if n == 3:
if n == 5:
direction = -1
elif n == 0:
direction = 1
for i in xrange(6):
for j in xrange(4):
for i in xrange(8):
for j in xrange(6):
if j == n:
pix.append((1023.0,0.0,0.0))
else:
Expand Down
10 changes: 5 additions & 5 deletions animations/light-dance/main.py
Expand Up @@ -6,25 +6,25 @@
if __name__ == "__main__":
import time
out = ColorsOut()
pix = [(0.0,0.0,0.0)] * 24
pix = [(0.0,0.0,0.0)] * 48
fallRate = 7.0
sleepTimer = 0.02
frameMax = 40
frames = 0
for i in xrange(24):
for i in xrange(48):
pix[i] = (0.0 , 0.0, 0.0)

while True:
if frames < 0:
pix[random.randint(0, 23.0)] = (1023.0, 1023.0, 1023.0)
pix[random.randint(0, 47.0)] = (1023.0, 1023.0, 1023.0)
frames = random.randint(0, frameMax)

else:
frames = frames - 1

out.write(pix)

for i in xrange(24):
for i in xrange(48):
pix[i] = (pix[i][0] - fallRate, pix[i][1] - fallRate, pix[i][2] - fallRate)

time.sleep(sleepTimer)
time.sleep(sleepTimer)
2 changes: 1 addition & 1 deletion animations/pong/main.py
Expand Up @@ -35,7 +35,7 @@ def check_speed(curr, speed, end): #Helper function that keeps the ball in bound
x_vals = Queue(maxsize=tailsize)
y_vals = Queue(maxsize=tailsize)
out = FadeAnimation() #Set up the fade animation
out.FADERATE = 1.0
out.FADERATE = 5.0
out.start()

for i in range(MAX_X * MAX_Y):
Expand Down
2 changes: 1 addition & 1 deletion animations/rain-hues/main.py
Expand Up @@ -6,7 +6,7 @@
from oscapi import ColorsOut
from animations import FadeAnimation

MAX_BULBS = 24
MAX_BULBS = 48

fps = 60.0

Expand Down
10 changes: 5 additions & 5 deletions animations/random/main.py
Expand Up @@ -19,20 +19,20 @@
if __name__ == "__main__":
import time
out = ColorsOut()
pix_A = [(0.0,0.0,0.0)]*24
pix_B = [(0.0,0.0,0.0)]*24
pix_A = [(0.0,0.0,0.0)]*48
pix_B = [(0.0,0.0,0.0)]*48
while True:
pix_A = pix_B[:]
for i in range(24):
for i in range(48):
while pix_B[i] == pix_A[i]:
pix_B[i] = random.choice(nice_pixels)

pix = [(0.0,0.0,0.0)]*24
pix = [(0.0,0.0,0.0)]*48
for i in range(int(real_steps+1)):
d = float(i)/float(real_steps)
d = math.sin(d * math.pi * 0.5)
dp = 1-d
for j in range(24):
for j in range(48):
(r1,g1,b1) = pix_A[j]
(r2,g2,b2) = pix_B[j]
pix[j] = (r1*dp + r2*d, g1*dp + g2*d, b1*dp + b2*d)
Expand Down
8 changes: 4 additions & 4 deletions animations/refridgerator/main.py
Expand Up @@ -8,22 +8,22 @@
if __name__ == "__main__":
import time
out = ColorsOut()
pix = [(0.0,0.0,0.0)] * 24
pix = [(0.0,0.0,0.0)] * 48
runInAnimation = True
smoothnessRatio = 110
sleepTime = .01
while True:
if runInAnimation:
for i in xrange(12):
pix[random.randint(0,23)] = (0.0, 0.0, pix[i][2] + 1023/smoothnessRatio)
pix[random.randint(0,47)] = (0.0, 0.0, pix[i][2] + 1023/smoothnessRatio)
out.write(pix)
if pix[i][2] > 900:
runInAnimation = False
time.sleep(sleepTime)
else:
for i in xrange(12):
pix[random.randint(0,23)] = (0.0, 0.0, pix[i][2] - 1023/smoothnessRatio)
pix[random.randint(0,47)] = (0.0, 0.0, pix[i][2] - 1023/smoothnessRatio)
out.write(pix)
if pix[i][2] < 100.0:
runInAnimation = True
time.sleep(sleepTime)
time.sleep(sleepTime)
4 changes: 2 additions & 2 deletions animations/spin/main.py
Expand Up @@ -9,8 +9,8 @@
out.FADERATE = 32.0
out.start()

pix = [(1023.0,1023.0,1023.0)]*24
path = [0,1,2,3,7,11,15,14,13,12,8,4]
pix = [(1023.0,1023.0,1023.0)]*48
path = [0,1,2,3,4,5,11,17,23,29,35,41,47,46,45,44,43,42,36,30,24,18,12,6]

sleeptime = 0.02

Expand Down
2 changes: 1 addition & 1 deletion animations/white/main.py
Expand Up @@ -12,6 +12,6 @@
#g = 255.0
#b = 70.0
while True:
pix = [(4.0 * r, 4.0 * g, 4.0 * b)] * 24
pix = [(4.0 * r, 4.0 * g, 4.0 * b)] * 48
out.write(pix)
time.sleep(0.2)

0 comments on commit cf57c80

Please sign in to comment.