mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
.
This commit is contained in:
parent
89347b118c
commit
a5b40a7ea8
@ -1,35 +1,45 @@
|
|||||||
import hyperion, time, datetime
|
import hyperion, time, datetime
|
||||||
|
|
||||||
|
hyperion.imageMinSize(32,32)
|
||||||
|
|
||||||
# Get the parameters
|
# Get the parameters
|
||||||
showSeconds = bool(hyperion.args.get('show_seconds', True))
|
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))
|
||||||
|
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)
|
centerX = int(round(hyperion.imageWidth())/2)
|
||||||
centerY = int(round(float(hyperion.imageHeight())/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([
|
colorsSecond = bytearray([
|
||||||
0, 255,255,0,255,
|
0, sC[0],sC[1],sC[2],255,
|
||||||
5, 255,255,0,255,
|
8, sC[0],sC[1],sC[2],255,
|
||||||
30, 0,0,0,0,
|
10, 0,0,0,0,
|
||||||
])
|
])
|
||||||
|
|
||||||
colorsMinute = bytearray([
|
colorsMinute = bytearray([
|
||||||
0, 0,255,0,255,
|
0, mC[0],mC[1],mC[2],255,
|
||||||
5, 0,255,0,250,
|
35, mC[0],mC[1],mC[2],255,
|
||||||
|
50, mC[0],mC[1],mC[2],127,
|
||||||
90, 0,0,0,0,
|
90, 0,0,0,0,
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
colorsHour = bytearray([
|
colorsHour = bytearray([
|
||||||
0, 0,0,255,255,
|
0, hC[0],hC[1],hC[2],255,
|
||||||
10, 0,0,255,255,
|
90, hC[0],hC[1],hC[2],255,
|
||||||
127, 0,0,196,127,
|
150, hC[0],hC[1],hC[2],127,
|
||||||
255, 0,0,196,5,
|
191, 0,0,0,0,
|
||||||
])
|
])
|
||||||
|
|
||||||
colorsHourTop = bytearray([
|
|
||||||
0, 0,0,255,250,
|
|
||||||
10, 0,0,255,128,
|
|
||||||
20, 0,0,0,0,
|
|
||||||
])
|
|
||||||
|
|
||||||
# effect loop
|
# effect loop
|
||||||
while not hyperion.abort():
|
while not hyperion.abort():
|
||||||
@ -43,12 +53,25 @@ while not hyperion.abort():
|
|||||||
angleM -= 0 if angleM<360 else 360
|
angleM -= 0 if angleM<360 else 360
|
||||||
angleS -= 0 if angleS<360 else 360
|
angleS -= 0 if angleS<360 else 360
|
||||||
|
|
||||||
hyperion.imageSolidFill(127,127,127);
|
#reset image
|
||||||
|
hyperion.imageSolidFill(bgC[0],bgC[1],bgC[2])
|
||||||
|
|
||||||
|
#paint clock
|
||||||
|
if angleH-angleM < 90 and angleH-angleM > 0:
|
||||||
|
hyperion.imageCanonicalGradient(centerX, centerY, angleM, colorsMinute)
|
||||||
|
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHour)
|
||||||
|
else:
|
||||||
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHour)
|
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHour)
|
||||||
hyperion.imageCanonicalGradient(centerX, centerY, angleM, colorsMinute)
|
hyperion.imageCanonicalGradient(centerX, centerY, angleM, colorsMinute)
|
||||||
hyperion.imageCanonicalGradient(centerX, centerY, angleH, colorsHourTop)
|
|
||||||
if showSeconds:
|
if showSec:
|
||||||
hyperion.imageCanonicalGradient(centerX, centerY, angleS, colorsSecond)
|
hyperion.imageCanonicalGradient(centerX, centerY, angleS, colorsSecond)
|
||||||
|
if markD > 0.0:
|
||||||
|
#marker left, right, top, bottom
|
||||||
|
hyperion.imageDrawLine(0, centerY, 0+markDepthX, centerY, markThick, markC[0], markC[1], markC[2])
|
||||||
|
hyperion.imageDrawLine(int(hyperion.imageWidth()), centerY, int(hyperion.imageWidth())-markDepthX, centerY, markThick, markC[0], markC[1], markC[2])
|
||||||
|
hyperion.imageDrawLine(centerX, 0, centerX, 0+markDepthY, markThick, markC[0], markC[1], markC[2])
|
||||||
|
hyperion.imageDrawLine(centerX, int(hyperion.imageHeight()), centerX, int(hyperion.imageHeight())-markDepthY, markThick, markC[0], markC[1], markC[2])
|
||||||
|
|
||||||
hyperion.imageShow()
|
hyperion.imageShow()
|
||||||
time.sleep(0.5 )
|
time.sleep(1)
|
Loading…
Reference in New Issue
Block a user