changing a color with transition.to

I don’t know if I can do setFillcolor… or if I can use the .fill gradient. I saw something about:

[filterParameter] (optional)

Number. Applicable only if the target is a fill.effect applied to a ShapeObject. In this case, [filterParameter] indicates an effect property associated with the specific filter effect, for example ShapeObject.fill.effect.intensity. See the Effects Guide for which filter parameters apply to each filter.

 

in the discription, but I don’t really want to use a fill effect persay… just want the color to change on my health meter.

 

so I have this…

 

local paint = {} paint.green = { type = "gradient", color1 = { .2, .4, .2 }, color2 = { 0, 1, 0 }, direction = "up" } paint.blue = { type = "gradient", color1 = { .2, .2, .4 }, color2 = { 0, 0, 1 }, direction = "up" } paint.red = { type = "gradient", color1 = { 1, 0, 0 }, color2 = { 1, 0, 0 }, direction = "up" }

and that works great for LifeMeter.fill = paint.red

but how can I (can i?) put this into a simple transition.to ?

so when the player gets hurt, I turn their LifeMeter red and then transition the size, kinda street fighter like.

I have that which is neat…   transition.to( LifeMeter, {time=200,  xScale = percent  })

I would like to add one for the color… but hmm… don’t know how to write it…

transition.to( LifeMeter, { time = 200, fill=paint.paintGreen } )

doesn’t seem to do anything. :/ 

I know RoamingGamer had a module with this feature in it a couple years ago. He would be the best to comment on whether it still works, but it’s worth a shot!

@LavaLevel,

Hi.  I adopted a solution from someones older code here:

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

Note: This is a straight setFillColor() change, not a fill, nor does it use gradients.  It might however be modifyable for that purpose.

I know RoamingGamer had a module with this feature in it a couple years ago. He would be the best to comment on whether it still works, but it’s worth a shot!

@LavaLevel,

Hi.  I adopted a solution from someones older code here:

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

Note: This is a straight setFillColor() change, not a fill, nor does it use gradients.  It might however be modifyable for that purpose.