Disco Lights

From kJams Wiki
Revision as of 21:36, 11 December 2014 by Dave (talk | contribs) (Created page with "I set up a few lights around the room, [http://lifx.co/ with LIFX bulbs], but you could as easily use [http://www.meethue.com Phillips Hue bulbs]. Then i run [http://peacockm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I set up a few lights around the room, with LIFX bulbs, but you could as easily use Phillips Hue bulbs.

Then i run LIFXstyle or Hue-topia.

Then i run my color-changing-lights script:

tell application "LIFXStyle"
	set hueScaleFactor to 3
	set maxValue to 255
	
	set barnList to {"Barn Desk Right", "Barn Desk Left", "Barn Wall", "Barn Stairs", "Barn Beam Uplight"}
	set poolList to {"Pool Left", "Pool Middle", "Pool Right "}
	set musicRoomList to {"Tall Lamp"}
	
	set lampNameList to barnList & poolList & musicRoomList
	
	set lampList to {}
	repeat with curLamp in lampNameList
		set lampList to lampList & {a reference to (first lamp whose title is curLamp)}
	end repeat
	
	repeat with curLamp in lampList
		set (whiteness of curLamp) to 25
		set (brightness of curLamp) to maxValue
	end repeat
	
	set hueStart to hue of item 1 of lampList
	set hueStartScaled to (hueStart / hueScaleFactor) as integer
	set hueEndScaled to (maxValue / hueScaleFactor) as integer
	
	repeat
		repeat with hueValue from hueStartScaled to hueEndScaled
			set curScaledHue to (hueValue * hueScaleFactor)
			
			repeat with itemNo from 1 to count of lampList
				set curLamp to item itemNo of lampList
				set curLampHue to ((curScaledHue + (itemNo * 45)) mod 255) as integer
				set (hue of curLamp) to curLampHue
			end repeat
			
			delay 0.25
		end repeat
		
		set hueStartScaled to 0
	end repeat
end tell