我有一个颜色代码列表,想让文字像这张图片一样平滑地淡化颜色:
Corona有可能吗?我还没有办法做到这一点。
答案 0 :(得分:2)
尝试我制作的这个功能,可能不完美,但它对我有用:
-- Transitions a display object from one color to another (based on 0 to 1 values)
function applyColorTransition(oDisplayObject, nDelay, nStartR, nEndR, nStartG, nEndG, nStartB, nEndB)
if oDisplayObject.setFillColor then
local nIterations = 10
local nStepsR = (nEndR - nStartR) / nIterations
local nStepsG = (nEndG - nStartG) / nIterations
local nStepsB = (nEndB - nStartB) / nIterations
local nI = 1
timer.performWithDelay( nDelay, function()
oDisplayObject:setFillColor(nStartR + nStepsR * nI, nStartG + nStepsG * nI, nStartB + nStepsB * nI)
nI = nI + 1
end, nIterations)
end
end