|
本帖最后由 AndroidOL 于 2014-10-9 22:16 编辑
当前进度:
渐变算法初步完成
待处理问题:
计算精度存在约一个色彩值的差异(正在解决
无设备预览,不清楚具体显示效果(请求预览
如果无限循环将导致脚本占用线程(正在解决
- function OnEvent(event, arg)
- if (event == "G_PRESSED") then
- colorList = {}
- table.insert(colorList, {
- Name = "#FF1B1B",
- Red = 255,
- Green = 27,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#FF761B",
- Red = 255,
- Green = 118,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#FFA41B",
- Red = 255,
- Green = 164,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#FFD21B",
- Red = 255,
- Green = 210,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#FEFF1B",
- Red = 254,
- Green = 255,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#B1E819",
- Red = 177,
- Green = 232,
- Blue = 25
- })
- table.insert(colorList, {
- Name = "#17D21B",
- Red = 23,
- Green = 210,
- Blue = 27
- })
- table.insert(colorList, {
- Name = "#17A2D2",
- Red = 23,
- Green = 162,
- Blue = 210
- })
- table.insert(colorList, {
- Name = "#1763D2",
- Red = 23,
- Green = 99,
- Blue = 210
- })
- table.insert(colorList, {
- Name = "#3817D2",
- Red = 56,
- Green = 23,
- Blue = 210
- })
- table.insert(colorList, {
- Name = "#9717D2",
- Red = 151,
- Green = 23,
- Blue = 210
- })
- table.insert(colorList, {
- Name = "#DE1888",
- Red = 222,
- Green = 24,
- Blue = 136
- })
- colorTemp = {
- ["Red"] = 255,
- ["Green"] = 255,
- ["Blue"] = 255
- }
- flag = 1
- --SetBacklightColor(255, 255, 255)
- flag = 0
- for loop = 1, #colorList do
- OutputLogMessage("Color-No." .. loop .. ":\t" .. colorList[loop].Name .. "\n")
- r = colorTemp.Red
- g = colorTemp.Green
- b = colorTemp.Blue
- rIV = (colorList[loop].Red - r) / 50 - ((colorList[loop].Red - r) / 50) % 0.01
- gIV = (colorList[loop].Green - g) / 50 - ((colorList[loop].Green - g) / 50) % 0.01
- bIV = (colorList[loop].Blue - b) / 50 - ((colorList[loop].Blue - b) / 50) % 0.01
- OutputLogMessage("rIV.Red: " .. rIV .. ",\tgIV: " .. gIV .. ",\tbIV: " .. bIV .. "\n")
- for loopColor = 1, 50 do
- colorTemp.Red = colorTemp.Red + rIV
- colorTemp.Green = colorTemp.Green + gIV
- colorTemp.Blue = colorTemp.Blue + bIV
- --OutputLogMessage("colorTemp.Red: " .. colorTemp.Red .. ",\tcolorTemp.Green: " .. colorTemp.Green .. ",\tcolorTemp.Blue: " .. colorTemp.Blue .. "\n")
- Sleep(50)
- end
- colorTemp.Red = math.ceil(colorTemp.Red)
- colorTemp.Green = math.ceil(colorTemp.Green)
- colorTemp.Blue = math.ceil(colorTemp.Blue)
- OutputLogMessage("Loop: " .. loop .. ". Target. To. R: " .. colorTemp.Red .. "/G: " .. colorTemp.Green .. "/B: " .. colorTemp.Blue .. "\n")
- OutputLogMessage("Loop: " .. loop .. ". Target. To. R: " .. colorList[loop].Red .. "/G: " .. colorList[loop].Green .. "/B: " .. colorList[loop].Blue .. "\n\n")
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|