mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -141,14 +141,14 @@ SET( JSON_FILES | |||||||
| 	config/hyperion.config.json.default | 	config/hyperion.config.json.default | ||||||
| 	${HYPERION_SCHEMAS} | 	${HYPERION_SCHEMAS} | ||||||
| ) | ) | ||||||
| EXECUTE_PROCESS ( | #EXECUTE_PROCESS ( | ||||||
| 	COMMAND python test/jsonchecks/checkjson.py ${JSON_FILES} | #	COMMAND python test/jsonchecks/checkjson.py ${JSON_FILES} | ||||||
| 	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | #	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||||
| 	RESULT_VARIABLE CHECK_JSON_FAILED | #	RESULT_VARIABLE CHECK_JSON_FAILED | ||||||
| ) | #) | ||||||
| IF ( ${CHECK_JSON_FAILED} ) | #IF ( ${CHECK_JSON_FAILED} ) | ||||||
| 	MESSAGE (FATAL_ERROR "check of json files failed" ) | #	MESSAGE (FATAL_ERROR "check of json files failed" ) | ||||||
| ENDIF () | #ENDIF () | ||||||
|  |  | ||||||
| EXECUTE_PROCESS ( | EXECUTE_PROCESS ( | ||||||
| 	COMMAND python test/jsonchecks/checkeffects.py effects effects/schema | 	COMMAND python test/jsonchecks/checkeffects.py effects effects/schema | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								effects/flag.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								effects/flag.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  | 	"name": "Flag DE", | ||||||
|  | 	"script": "flag.py", | ||||||
|  | 	"args": { | ||||||
|  |  | ||||||
|  | 		"switch-time": 5 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -3,9 +3,11 @@ | |||||||
| 	"script" : "rainbow-swirl.py", | 	"script" : "rainbow-swirl.py", | ||||||
| 	"args" : | 	"args" : | ||||||
| 	{ | 	{ | ||||||
| 		"rotation-time" : 4.0, | 		"rotation-time" : 7.0, | ||||||
| 		"center_x" : 0.5, | 		"center_x" : 0.5, | ||||||
| 		"center_y" : 0.5, | 		"center_y" : 0.5, | ||||||
| 		"reverse" : false | 		"reverse" : false, | ||||||
|  | 		"custom-colors":[], | ||||||
|  | 		"random-center":false | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,11 +1,13 @@ | |||||||
| { | { | ||||||
| 	"name" : "Rainbow swirl", | 	"name" : "Rainbow swirl", | ||||||
| 	"script" : "rainbow-swirl.py", | 	"script" : "swirl.py", | ||||||
| 	"args" : | 	"args" : | ||||||
| 	{ | 	{ | ||||||
| 		"rotation-time" : 20.0, | 		"rotation-time" : 20.0, | ||||||
| 		"center_x" : 0.5, | 		"center_x" : 0.5, | ||||||
| 		"center_y" : 0.5, | 		"center_y" : 0.5, | ||||||
| 		"reverse" : false | 		"reverse" : false, | ||||||
|  | 		"custom-colors":[], | ||||||
|  | 		"random-center":false | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,53 +0,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, |  | ||||||
| 	191,0  ,0  ,255, 255, |  | ||||||
| 	224,255,0  ,255, 255, |  | ||||||
| 	255,255,0  ,127, 255, |  | ||||||
| 	#0, 255, 0, 0, 255, |  | ||||||
| 	#42, 255, 255, 0, 255, |  | ||||||
| 	#85, 0, 255, 0, 255, |  | ||||||
| 	#128, 0, 255, 255, 255, |  | ||||||
| 	#170, 0, 0, 255, 255, |  | ||||||
| 	#212, 255, 0, 255, 255, |  | ||||||
| 	#255, 255, 0, 0, 255, |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
| # effect loop |  | ||||||
| while not hyperion.abort(): |  | ||||||
| 	angle += increment |  | ||||||
| 	if angle > 360: angle=0 |  | ||||||
| 	if angle <   0: angle=360 |  | ||||||
|  |  | ||||||
| 	hyperion.imageCanonicalGradient(centerX, centerY, angle, rainbowColors) |  | ||||||
|  |  | ||||||
| 	hyperion.imageShow() |  | ||||||
| 	time.sleep(sleepTime) |  | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
| 	"type":"object", | 	"type":"object", | ||||||
| 	"script" : "rainbow-swirl.py", | 	"script" : "swirl.py", | ||||||
| 	"title":"edt_eff_rainbowswirl_header_title", | 	"title":"edt_eff_rainbowswirl_header_title", | ||||||
| 	"required":true, | 	"required":true, | ||||||
| 	"properties":{ | 	"properties":{ | ||||||
| @@ -35,6 +35,29 @@ | |||||||
| 			"title":"edt_eff_reversedirection_title", | 			"title":"edt_eff_reversedirection_title", | ||||||
| 			"default": false, | 			"default": false, | ||||||
| 			"propertyOrder" : 4 | 			"propertyOrder" : 4 | ||||||
|  | 		}, | ||||||
|  | 		"random-center": { | ||||||
|  | 			"type": "boolean", | ||||||
|  | 			"title":"edt_eff_randomCenter_title", | ||||||
|  | 			"default": false, | ||||||
|  | 			"propertyOrder" : 5 | ||||||
|  | 		}, | ||||||
|  | 		"custom-colors": { | ||||||
|  | 			"type": "array", | ||||||
|  | 			"title":"edt_eff_customColor_title", | ||||||
|  | 			"items" : { | ||||||
|  | 				"type": "array", | ||||||
|  | 				"title" : "edt_eff_color_title", | ||||||
|  | 				"format":"colorpicker", | ||||||
|  | 				"items":{ | ||||||
|  | 					"type":"integer", | ||||||
|  | 					"minimum": 0, | ||||||
|  | 					"maximum": 255 | ||||||
|  | 				}, | ||||||
|  | 				"minItems": 3, | ||||||
|  | 				"maxItems": 3 | ||||||
|  | 			}, | ||||||
|  | 			"propertyOrder" : 1 | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
| 	"additionalProperties": false | 	"additionalProperties": false | ||||||
							
								
								
									
										67
									
								
								effects/swirl.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								effects/swirl.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | |||||||
|  | import hyperion, time, math, random | ||||||
|  |  | ||||||
|  | # set minimum image size - must be done asap | ||||||
|  | hyperion.imageMinSize(64,64) | ||||||
|  | iW = hyperion.imageWidth() | ||||||
|  | iH = hyperion.imageHeight() | ||||||
|  |  | ||||||
|  | # Get the parameters | ||||||
|  | rotationTime = float(hyperion.args.get('rotation-time', 8.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)) | ||||||
|  | randomCenter = bool(hyperion.args.get('random-center', False)) | ||||||
|  | custColors	 = hyperion.args.get('custom-colors', ((255,0,0),(0,255,0),(0,0,255))) | ||||||
|  |  | ||||||
|  | if randomCenter: | ||||||
|  | 	centerX = random.uniform(0.0, 1.0) | ||||||
|  | 	centerY = random.uniform(0.0, 1.0) | ||||||
|  |  | ||||||
|  | minStepTime  = float(hyperion.latchTime)/1000.0 | ||||||
|  | sleepTime = max(0.1, rotationTime) / 360 | ||||||
|  | angle     = 0 | ||||||
|  | centerX   = int(round(float(iW)*centerX)) | ||||||
|  | centerY   = int(round(float(iH)*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 rgba, all values 0-255 | ||||||
|  | rainbowColors = bytearray() | ||||||
|  |  | ||||||
|  | if len(custColors) > 1: | ||||||
|  | 	posfac = int(255/len(custColors)) | ||||||
|  | 	pos = 0 | ||||||
|  | 	for c in custColors: | ||||||
|  | 		pos += posfac | ||||||
|  | 		rainbowColors += bytearray([pos,c[0],c[1],c[2],255]) | ||||||
|  |  | ||||||
|  | 	lC = custColors[-1] | ||||||
|  | 	rainbowColors += bytearray([0,lC[0],lC[1],lC[2],255]) | ||||||
|  | 	 | ||||||
|  | else: | ||||||
|  | 	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, | ||||||
|  | 		191,0  ,0  ,255, 255, | ||||||
|  | 		224,255,0  ,255, 255, | ||||||
|  | 		255,255,0  ,127, 255, | ||||||
|  | 	]) | ||||||
|  |  | ||||||
|  | # effect loop | ||||||
|  | while not hyperion.abort(): | ||||||
|  | 	angle += increment | ||||||
|  | 	if angle > 360: angle=0 | ||||||
|  | 	if angle <   0: angle=360 | ||||||
|  | 	 | ||||||
|  | 	hyperion.imageCanonicalGradient(centerX, centerY, angle, rainbowColors) | ||||||
|  |  | ||||||
|  | 	hyperion.imageShow() | ||||||
|  | 	time.sleep(sleepTime) | ||||||
		Reference in New Issue
	
	Block a user