size = { 1024, 640 }

defineProperty("switch_1", globalPropertyf("sim/cockpit2/switches/custom_slider_on[2]"))  -- on/off panel menu
defineProperty("local_time", globalPropertyf("sim/time/local_time_sec")) -- local time
defineProperty("switch_3", globalPropertyf("sim/custom/xap/post_effect_trans")) -- post effect transparency
defineProperty("local_time_sec", globalPropertyf("sim/cockpit2/clock_timer/local_time_seconds")) -- local time

defineProperty("background", loadImage("vinet.png", 0, 0, 1024, 640)) -- vinet texture

local lightSoft = 0
local time = get(local_time)




function update() -- all calculations causes every frame


if get(local_time) > 23000 and get(local_time) < 66000 then
		lightSoft =  ( (-0.216333 * (get(local_time) / 10000) * (get(local_time) / 10000)) + (1.925364 * (get(local_time) / 10000)) - 3.283935 ) + 0.5 else
		lightSoft = 0.5 			
	end
	set(switch_3, lightSoft)
	time = get(local_time)
end
components = {

-- night texture
textureLitSoft {
	position = {  0, 0, 1024, 640 },
        image = get(background),
	visible = true,
	movable = false,
	softLight = function() 
			return lightSoft
		    end
 },  
     
}