Exemplo n.º 1
0
def getPoint(rand = True ,x = 0.5, y = 0.5):
	if rand:
		x = random.uniform(0.0, 1.0)
		y = random.uniform(0.0, 1.0)
	x = int(round(x*hyperion.imageWidth()))
	y = int(round(y*hyperion.imageHeight()))
	return (x,y)
Exemplo n.º 2
0
def getPoint(rand=True, x=0.5, y=0.5):
    if rand:
        x = random.uniform(0.0, 1.0)
        y = random.uniform(0.0, 1.0)
    x = int(round(x * hyperion.imageWidth()))
    y = int(round(y * hyperion.imageHeight()))
    return (x, y)
Exemplo n.º 3
0
import hyperion
import time
import colorsys
import random

min_len = int(hyperion.args.get('min_len', 3))
max_len = int(hyperion.args.get('max_len', 3))
#iHeight = int(hyperion.args.get('iHeight', 8))
trails = int(hyperion.args.get('int', 8))
sleepTime = float(hyperion.args.get('speed', 1)) / 1000.0
color = list(hyperion.args.get('color', (255,255,255)))
randomise = bool(hyperion.args.get('random', False))
iWidth = hyperion.imageWidth()
iHeight = hyperion.imageHeight()

class trail:
	def __init__(self):
		return

	def start(self, x, y, step, color, _len, _h):
		self.pos = 0.0
		self.step = step
		self.h = _h
		self.x = x
		self.data = []
		brigtness = color[2]
		step_brigtness = color[2] / _len
		for i in range(0, _len):
			rgb = colorsys.hsv_to_rgb(color[0], color[1], brigtness)
			self.data.insert(0, (int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2])))
			brigtness -= step_brigtness
Exemplo n.º 4
0
hyperion.imageMinSize(32,32)

# Get the parameters
showSec    = bool(hyperion.args.get('show_seconds', True))
hC         = hyperion.args.get('hour-color', (0,0,255))
mC  	   = hyperion.args.get('minute-color', (0,255,0))
sC 		   = hyperion.args.get('second-color', (255,0,0))
bgC		   = hyperion.args.get('background-color', (0,0,0))
markEnable = hyperion.args.get('marker-enabled', False)
markD      = int(hyperion.args.get('marker-depth', 5))/100.0
markW      = int(hyperion.args.get('marker-width', 5))/100.0
markC	   = hyperion.args.get('marker-color', (255,255,255))


#calculate some stuff
centerX    = int(round(hyperion.imageWidth())/2)
centerY    = int(round(float(hyperion.imageHeight())/2))
markDepthX = int(round(hyperion.imageWidth()*markD))
markDepthY = int(round(hyperion.imageHeight()*markD))
markThick  = int(round(hyperion.imageHeight()*markW))

colorsSecond = bytearray([
	0, sC[0],sC[1],sC[2],255,
	8, sC[0],sC[1],sC[2],255,
	10, 0,0,0,0,
])

colorsMinute = bytearray([
	0, mC[0],mC[1],mC[2],255,
	35, mC[0],mC[1],mC[2],255,
	50, mC[0],mC[1],mC[2],127,
Exemplo n.º 5
0
randomCenter = bool(hyperion.args.get('random-center', False))
centerX      = float(hyperion.args.get('center_x', -0.15))
centerY      = float(hyperion.args.get('center_y', -0.25))
rotationTime = float(hyperion.args.get('rotation_time', 90))
colors       = hyperion.args.get('colors', ((255,0,0),(255,255,0),(0,255,0),(0,255,255),(0,0,255),(255,0,255)))
reverse      = bool(hyperion.args.get('reverse', False))
reverseTime  = int(hyperion.args.get('reverse_time', 0))
#rotate       = bool(hyperion.args.get('rotate', True))
positions    = []

# calc center if random
if randomCenter:
	centerX = random.uniform(0.0, 1.0)
	centerY = random.uniform(0.0, 1.0)

rCenterX   = int(round(float(hyperion.imageWidth())*centerX))
rCenterY   = int(round(float(hyperion.imageHeight())*centerY))

#calc interval
sleepTime = max(1/(255/rotationTime), 0.016)

#calc diagonal
if centerX < 0.5:
	cX = 1.0-centerX
else:
	cX = 0.0+centerX

if centerY < 0.5:
	cY = 1.0-centerY
else:
	cY = 0.0+centerY
Exemplo n.º 6
0
import hyperion, time, math

# set minimum image size - must be done asap
hyperion.imageMinSize(32,32)

# Get the parameters
rotationTime = float(hyperion.args.get('rotation-time', 3.0))
reverse      = bool(hyperion.args.get('reverse', False))
centerX      = float(hyperion.args.get('center_x', 0.5))
centerY      = float(hyperion.args.get('center_y', 0.5))

minStepTime  = float(hyperion.latchTime)/1000.0
sleepTime = max(0.1, rotationTime) / 360
angle     = 0
centerX   = int(round(float(hyperion.imageWidth())*centerX))
centerY   = int(round(float(hyperion.imageHeight())*centerY))
increment = -1 if reverse else 1

# adapt sleeptime to hardware
if minStepTime > sleepTime:
	increment *= int(math.ceil(minStepTime / sleepTime))
	sleepTime  = minStepTime

# table of stop colors for rainbow gradient, first is the position, next rgb, all values 0-255
rainbowColors = bytearray([
	0  ,255,0  ,0, 255,
	25 ,255,230,0, 255,
	63 ,255,255,0, 255,
	100,0  ,255,0, 255,
	127,0  ,255,200, 255,
	159,0  ,255,255, 255,
Exemplo n.º 7
0
centerY = float(hyperion.args.get('center_y', -0.25))
rotationTime = float(hyperion.args.get('rotation_time', 90))
colors = hyperion.args.get('colors',
                           ((255, 0, 0), (255, 255, 0), (0, 255, 0),
                            (0, 255, 255), (0, 0, 255), (255, 0, 255)))
reverse = bool(hyperion.args.get('reverse', False))
reverseTime = int(hyperion.args.get('reverse_time', 0))
#rotate       = bool(hyperion.args.get('rotate', True))
positions = []

# calc center if random
if randomCenter:
    centerX = random.uniform(0.0, 1.0)
    centerY = random.uniform(0.0, 1.0)

rCenterX = int(round(float(hyperion.imageWidth()) * centerX))
rCenterY = int(round(float(hyperion.imageHeight()) * centerY))

#calc interval
sleepTime = max(1 / (255 / rotationTime), 0.016)

#calc diagonal
if centerX < 0.5:
    cX = 1.0 - centerX
else:
    cX = 0.0 + centerX

if centerY < 0.5:
    cY = 1.0 - centerY
else:
    cY = 0.0 + centerY
Exemplo n.º 8
0
import hyperion, time, datetime

# Get the parameters
showSeconds = bool(hyperion.args.get('show_seconds', True))
centerX = int(round(hyperion.imageWidth()) / 2)
centerY = int(round(float(hyperion.imageHeight()) / 2))

colorsSecond = bytearray([
    0,
    255,
    255,
    0,
    255,
    5,
    255,
    255,
    0,
    255,
    30,
    0,
    0,
    0,
    0,
])

colorsMinute = bytearray([
    0,
    0,
    255,
    0,
    255,