示例#1
0
    tailsize = 4  #Size of ping-pong ball's tail
    speed = 15.  #Speed of the Ball

    green_x = 0  #The Ball starts at (0,0) going bottom-right
    green_y = 0
    green_dir_x = 1
    green_dir_y = 1

    off = (0.0, 0.0, 0.0)  #We define three states the lights can be in
    half = (0.0, 512.0, 0.0)
    green = (0.0, 1023.0, 0.0)
    pix = []  #Set up data structures that hold light information
    x_vals = Queue(maxsize=tailsize)
    y_vals = Queue(maxsize=tailsize)
    out = FadeAnimation()  #Set up the fade animation
    out.FADERATE = 1.0
    out.start()

    for i in range(MAX_X * MAX_Y):
        pix.append(off)  #Turns Off all Lights
    x_vals.put(green_x)  #Put the first light on the array and turns it on
    y_vals.put(green_y)
    pix[(green_y * MAX_X) + green_x] = green
    out.write(pix)

    while True:
        time.sleep(1 / speed)  #Sleeps to keep the animation running at speed

        green_dir_x = check_speed(green_x, green_dir_x,
                                  MAX_X)  #Find the next direction we're going
        green_dir_y = check_speed(green_y, green_dir_y, MAX_Y)
示例#2
0
if conditions.find("Heavy") > -1:
	severe = 0.02
elif conditions.find("Light") > -1:
	severe = 0.2
else:
	severe = 0.05
i = 0
count = 0
print temp + "F"
print conditions

if __name__ == "__main__":
    import time
    out = FadeAnimation()
    pix = [(0.0,0.0,0.0)] * 24
    out.FADERATE = 10.0
    out.start()
		
    while True:		
#Rain
			if conditions.find("Rain") > -1:
				if random.randint(0,5) < 3:
					pix[random.randint(0,23)] = (0.0,0.0,1023.0)
				out.write(pix)
				for i in xrange(24):
					if pix[i][2] > 0.0:
						pix[i] = (0.0,0.0,pix[i][2] - 50.0)
					else:
						pix[i] = (0.0,0.0,0.0)
				time.sleep(severe)
#Thunder
示例#3
0
from random import randint, gammavariate
from animations import FadeAnimation
from math import sin, radians, degrees
from colorsys import hsv_to_rgb
speed = 40.0
light_count = 48


def randomness():
    return 1. if randint(1, 9 * 15 * 5) != 1 else 2


if __name__ == "__main__":
    import time
    out = FadeAnimation()
    out.FADERATE = 1.0  # seconds
    out.start()

    counter = 0.0

    while True:
        pix = [(0.0, 0.0, 0.0)] * light_count
        for i in range(9):
            for j in range(16):
                r = randomness()
                rgb = hsv_to_rgb(
                    (sin(radians(counter) / 2.0 + float(i) / 6.0) + 1.0) / 6.0,
                    1.0, 1.0)
                pix[i * 4 + j] = (rgb[0] * 1023.0, rgb[1] * 1023.0 / r,
                                  rgb[2] * 1023.0 / r)
        out.write(pix)
示例#4
0
import sys
from animations import FadeAnimation


if __name__ == "__main__":
    import time
    out = FadeAnimation()
    out.FADERATE = 8.0
    out.start()

    while True:
        for i in range(48):
            pix = [(800.0,800.0,800.0)]*48
            if i%8 == 0:
                pix[i] = (1023.0,0.0,0.0)
            else:
                pix[i] = (0.0,1023.0,1023.0)
            out.write(pix)
            time.sleep(0.2)
            #time.sleep(0.2)
示例#5
0
import sys
sys.path.append("./osc")
from animations import FadeAnimation


if __name__ == "__main__":
    import time
    import random

    stepDelay = 0.7
    stepFadeRate = 8
    fadeFadeRate = 20
    
    out = FadeAnimation()
    out.FADERATE = stepFadeRate
    out.start()
    pix = [(0.0,0.0,0.0)]*24
    colors = [(700.,0.,0.),
              (0.,700.,0.),
              (0.,0.,700.),
              (700.,700.,0.),
              (700.,0.,700.),
              (0.,700.,700.)
              ]
    path = [0,1,2,3,7,11,15,14,13,12,8,4,5,6,10,9]
    
    
    randOrder = random.sample(colors,len(colors))
    orderCount=0

    while True:
示例#6
0
import sys
sys.path.append("./osc")
from animations import FadeAnimation


if __name__ == "__main__":
    import time
    out = FadeAnimation()
    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]
    
    sleeptime = 0.02
    
    counter = 1
    while True:
        for i in range(len(path)):
            counter = counter + 1
            pix[path[i]] = (1023.0,0.0,0.0)
            pix[path[i-1]] = (511.5,511.5,0.0)
            pix[path[i-2]] = (0.0,1023.0,0.0)
            pix[path[i-3]] = (0.0,511.5,511.5)
            pix[path[i-4]] = (0.0,0.0,1023.0)
            pix[path[i-5]] = (511.5,0.0,511.5)
            pix[path[i-6]] = (1023.0,1023.0,1023.0)
            out.write(pix)
            sleeptime = sleeptime + 0.002
            time.sleep(sleeptime)
示例#7
0
import sys
from animations import FadeAnimation
from math import sin, radians, degrees
from colorsys import hsv_to_rgb

speed = 2.0

if __name__ == "__main__":
    import time
    out = FadeAnimation()
    out.FADERATE = 1.0 # seconds
    out.start()

    counter = 0

    red = (1024*0.9, 1024*0.1, 1024*0.1)
    orange = (1024*0.9, 1024*0.4, 1024*0.1)
    yellow = (1024*0.8, 1024*0.8, 1024*0.1)
    green = (1024*0.2, 1024*0.6, 1024*0.2)
    blue = (1024*0.2, 1024*0.2, 1024*0.7)
    purple = (1024*0.6, 1024*0.1, 1024*0.6)

    while True:
      pix = [(0.0,0.0,0.0)]*48
      if counter ==0:
        pix[0] = purple
        pix[6] = purple
        pix[12] = purple
        pix[18] = purple
        pix[24] = purple
        pix[30] = purple
示例#8
0
import sys
sys.path.append("./osc")
from animations import FadeAnimation

if __name__ == "__main__":
    import time
    out = FadeAnimation()
    out.FADERATE = 32.0
    out.start()

    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

    counter = 1
    while True:
        for i in range(len(path)):
            counter = counter + 1
            pix[path[i]] = (1023.0, 0.0, 0.0)
            pix[path[i - 1]] = (511.5, 511.5, 0.0)
            pix[path[i - 2]] = (0.0, 1023.0, 0.0)
            pix[path[i - 3]] = (0.0, 511.5, 511.5)
            pix[path[i - 4]] = (0.0, 0.0, 1023.0)
            pix[path[i - 5]] = (511.5, 0.0, 511.5)
            pix[path[i - 6]] = (1023.0, 1023.0, 1023.0)
            out.write(pix)
            sleeptime = sleeptime + 0.002
示例#9
0
import sys
from animations import FadeAnimation


if __name__ == "__main__":
    import time
    import random

    stepDelay = 0.7
    stepFadeRate = 8
    fadeFadeRate = 20
    
    out = FadeAnimation()
    out.FADERATE = stepFadeRate
    out.start()
    pix = [(0.0,0.0,0.0)]*24
    colors = [(700.,0.,0.),
              (0.,700.,0.),
              (0.,0.,700.),
              (700.,700.,0.),
              (700.,0.,700.),
              (0.,700.,700.)
              ]
    path = [0,1,2,3,7,11,15,14,13,12,8,4,5,6,10,9]
    
    
    randOrder = random.sample(colors,len(colors))
    orderCount=0

    while True:
        for i in xrange(16):
示例#10
0
import sys
from animations import FadeAnimation

if __name__ == "__main__":
    import time
    out = FadeAnimation()
    out.FADERATE = 8.0
    out.start()

    while True:
        for i in range(48):
            pix = [(800.0, 800.0, 800.0)] * 48
            if i % 8 == 0:
                pix[i] = (1023.0, 0.0, 0.0)
            else:
                pix[i] = (0.0, 1023.0, 1023.0)
            out.write(pix)
            time.sleep(0.2)
            #time.sleep(0.2)
示例#11
0
	tailsize = 4		   #Size of ping-pong ball's tail
	speed = 15.		   #Speed of the Ball

	green_x = 0		   #The Ball starts at (0,0) going bottom-right
	green_y = 0
	green_dir_x = 1
        green_dir_y = 1
	
	off = (0.0,0.0,0.0)        #We define three states the lights can be in
	half = (0.0, 512.0, 0.0)
	green = (0.0, 1023.0, 0.0)
	pix = []		   #Set up data structures that hold light information
	x_vals = Queue(maxsize=tailsize)
	y_vals = Queue(maxsize=tailsize)
	out = FadeAnimation()	   #Set up the fade animation
	out.FADERATE = 1.0
	out.start()
	
	for i in range(MAX_X * MAX_Y):
                pix.append(off)	   #Turns Off all Lights
	x_vals.put(green_x)	   #Put the first light on the array and turns it on
	y_vals.put(green_y)
	pix[(green_y * MAX_X) + green_x] = green
        out.write(pix)

	while True:
		time.sleep(1/speed)	#Sleeps to keep the animation running at speed

		green_dir_x = check_speed(green_x, green_dir_x, MAX_X)	#Find the next direction we're going
                green_dir_y = check_speed(green_y, green_dir_y, MAX_Y)
		pix[(green_y * MAX_X) + green_x] = half		#Set the last light to half