How would i go about transitioning a BG to a different color?

Here’s what i want.

local actualH = display.actualContentHeight local actualW = display.actualContentWidth local centerX = display.contentCenterX local centerY = display.contentCenterY local BG = display.newRect( centerX, centerY, actualW, actualH ) BG:setFillColor( 1, 0, 0 ) bob = transition.to( BG, { time = 1000, setFillColor( 0, 0, 1 )})

But transition.to doesn’t let you do that.

–SonicX278 

Hi,

this is a library that I have used and it works.

Download this: https://github.com/roaminggamer/RG_FreeStuff/blob/master/OuyaDumper/ssk/libs/extensions/transition_color.lua

Run it like this:

require "transition\_color" local myCircle = display.newCircle( 100, 100, 25 ) transition.fromtocolor( myCircle, { 1, 1, 1 }, { 0.5, 0.5 , 0.5 }, 2000 ) 

Best regards,

Tomas

@Tomas,

Thanks for answering and pointing to transition_color.

FYI, the official copy of that lives in SSK:

http://github.com/roaminggamer/SSKCorona/blob/master/ssk/extensions/transition_color.lua

i.e. SSK copies in free projects are usually out-of-date compared to the official GIT of SSK.

That function probably hasn’t changed, but… I do make occasional fixes and tweaks.

PS - Just for clarity sake to, I adapted (not adopted as my comment says in code  :rolleyes:  ) that from another developers solution.

Hi,

this is a library that I have used and it works.

Download this: https://github.com/roaminggamer/RG_FreeStuff/blob/master/OuyaDumper/ssk/libs/extensions/transition_color.lua

Run it like this:

require "transition\_color" local myCircle = display.newCircle( 100, 100, 25 ) transition.fromtocolor( myCircle, { 1, 1, 1 }, { 0.5, 0.5 , 0.5 }, 2000 ) 

Best regards,

Tomas

@Tomas,

Thanks for answering and pointing to transition_color.

FYI, the official copy of that lives in SSK:

http://github.com/roaminggamer/SSKCorona/blob/master/ssk/extensions/transition_color.lua

i.e. SSK copies in free projects are usually out-of-date compared to the official GIT of SSK.

That function probably hasn’t changed, but… I do make occasional fixes and tweaks.

PS - Just for clarity sake to, I adapted (not adopted as my comment says in code  :rolleyes:  ) that from another developers solution.