$cache.set("time", hh) var timer = $timer.schedule({ interval: 0.1, handler: function() { let i = $cache.get("time") let j = i + 60 let hex = HSV2HEX(i, ss, vv) $("1").bgcolor = $color(hex) $cache.set("time", i > 360 ? 0 : i + 2) } })
functionHSV2HEX(h, s, v) { var h = h > 359 ? 0 : h var s = s / 100 var v = v / 100
let h1 = Math.floor(h / 60) % 6 let f = h / 60 - h1 let p = v * (1 - s) let q = v * (1 - f * s) let t = v * (1 - (1 - f) * s)
if (h1 === 0) { r = v g = t b = p } elseif (h1 === 1) { r = q g = v b = p } elseif (h1 === 2) { r = p g = v b = t } elseif (h1 === 3) { r = p g = q b = v } elseif (h1 === 4) { r = t g = p b = v } elseif (h1 === 5) { r = v g = p b = q } let r = r * 255 let g = g * 255 let b = b * 255 let RGB = [Math.ceil(r), Math.ceil(g), Math.ceil(b)] let HEX = "#" + RGB2HEX(r, g, b)
return HEX }
functionRGB2HEX(r, g, b) { let r_ = Math.ceil(r).toString(16) let g_ = Math.ceil(g).toString(16) let b_ = Math.ceil(b).toString(16) let h = r_.length < 2 ? "0" + r_ : r_ let e = g_.length < 2 ? "0" + g_ : g_ let x = b_.length < 2 ? "0" + b_ : b_