Esempio n. 1
0
def orb(addr, tags, data, source):
	if (DEBUG):
		print "orb handler called"
		print "addr = " + str(addr) # /move
		# print "tags = " + str(tags) # is
		print "data = " + str(data) # [orbID, x, y, curvature, force, hue, distance, age]
		# print "sour = " + str(source) # (network info)
		# print "orbs = " + str(orbs)
	index		= data[0] % NUMBER_OF_LIGHTS
	orbs[index]	= [data[0],data[6],data[5],map_IDs[index]] # [orbID, distance, hue, canvasID]
	raw_color	= colorsys.hsv_to_rgb(data[5] / 360.0, 1, 1) #(h, s, v)
	mul			= 0
	if (data[5] > 220 and data[5] < 260): # color is blue
		mul		= (MIN_BRIGHTNESS[0])
	else: # color is not blue
		mul		= (MIN_BRIGHTNESS[0]) + ((MAX_BRIGHTNESS[0] - MIN_BRIGHTNESS[0]) * data[6]) # go from [0, 1) to [0, MAX_BRIGHTNESS)
	color = oscapi.mult(raw_color, mul)
	canvas[map_IDs[index]] = color
Esempio n. 2
0
def orb(addr, tags, data, source):
    if (DEBUG):
        print "orb handler called"
        print "addr = " + str(addr)  # /move
        # print "tags = " + str(tags) # is
        print "data = " + str(
            data)  # [orbID, x, y, curvature, force, hue, distance, age]
        # print "sour = " + str(source) # (network info)
        # print "orbs = " + str(orbs)
    index = data[0] % NUMBER_OF_LIGHTS
    orbs[index] = [data[0], data[6], data[5],
                   map_IDs[index]]  # [orbID, distance, hue, canvasID]
    raw_color = colorsys.hsv_to_rgb(data[5] / 360.0, 1, 1)  #(h, s, v)
    mul = 0
    if (data[5] > 220 and data[5] < 260):  # color is blue
        mul = (MIN_BRIGHTNESS[0])
    else:  # color is not blue
        mul = (MIN_BRIGHTNESS[0]) + (
            (MAX_BRIGHTNESS[0] - MIN_BRIGHTNESS[0]) * data[6]
        )  # go from [0, 1) to [0, MAX_BRIGHTNESS)
    color = oscapi.mult(raw_color, mul)
    canvas[map_IDs[index]] = color
Esempio n. 3
0
def plasmaCanvas():
	for i in range(0, NUMBER_OF_LIGHTS):
		r = ((random()*0.1) + 0.95)
		#if (DEBUG): print r
		canvas[i] = oscapi.mult(canvas[i], r)
	shuffle(map_IDs)
Esempio n. 4
0
def plasmaCanvas():
    for i in range(0, NUMBER_OF_LIGHTS):
        r = ((random() * 0.1) + 0.95)
        #if (DEBUG): print r
        canvas[i] = oscapi.mult(canvas[i], r)
    shuffle(map_IDs)