Changing a polygon's color over time

Hi, I’m wondering if it’s possible to use the “transition” functionality to change the color of a shape, such as a rectangle. I haven’t found the appropriate variables anywhere on the website, so I’m not sure if it can be done.
An example of what I’d like to do is call “transition.to()” to change my solid-color background’s rgb values over n milliseconds.
If that’s not possible, is there some other way to do this procedurally?

Thanks! [import]uid: 64510 topic_id: 10527 reply_id: 310527[/import]

I figured out how to use Runtime Events to allow color changing over time. So this isn’t a problem.

However, if there’s a transition parameter that anyone knows about for the “transition.to” function, please let me know, as that would save many lines of code.

If that isn’t implemented yet, can I make a request for those fill color parameters to be accessible in a similar way to all the other common parameters in a future patch/build? It would save a lot of time/code.

Thanks [import]uid: 64510 topic_id: 10527 reply_id: 38328[/import]

Can transition.to be used to “tween” any properties on a given object? [import]uid: 4596 topic_id: 10527 reply_id: 38329[/import]

simple code that i had made previously hope it helps

[lua]module(…, package.seeall)

function new()
local localGroup = display.newGroup()

local rect = display.newRect(0,0,200,200)
rect:setFillColor(0,0,0)

–store initial Value
rect.r = 0
rect.g = 0
rect.b = 0

local function changeRectColor(r,g,b)
rect:setFillColor(r,g,b)
end
local t,r,g,b
local function getNewRectColor(r,g,b)
t = math.abs(r - rect.r)
if math.abs(g - rect.g) > t then
t = math.abs(r - rect.r)
end
if math.abs(b - rect.b) > t then
t = math.abs(b - rect.b)
end

local function callMe()
if rect.r > r then
rect.r = rect.r - 1
else
rect.r = rect.r + 1
end
if rect.g > g then
rect.g = rect.g - 1
else
rect.g = rect.g + 1
end

if rect.b > b then
rect.b = rect.b - 1
else
rect.b = rect.b + 1
end
changeRectColor(rect.r,rect.g,rect.b)
end
timer.performWithDelay(30,callMe,t)
end
getNewRectColor(255,255,0)
return localGroup
end[/lua] [import]uid: 12482 topic_id: 10527 reply_id: 38372[/import]