Hi everyone,
Does anyone know if there is a way to transition the filling of an item with color so it looks like the color is fading in? [import]uid: 31262 topic_id: 27325 reply_id: 327325[/import]
Hi everyone,
Does anyone know if there is a way to transition the filling of an item with color so it looks like the color is fading in? [import]uid: 31262 topic_id: 27325 reply_id: 327325[/import]
I do not think there is an actual transition call. You would have to create your own using a timer with RGB something like this:
[lua]local testRect = display.newRect (0, 0, 100, 100)
testRect.x = 200; testRect.y = 200
local function transColors (obj)
local RGB = 1
local colorTimer
local function changeColors ()
RGB = RGB + 5
obj: setFillColor (RGB, 0, 0)
if RGB >= 250 then
timer.cancel (colorTimer)
colorTimer = nil
end
end
colorTimer = timer.performWithDelay (10, changeColors, -1)
end
transColors(testRect)[/lua]
That would fade an object from black into pure red, obviously you could mess around with the RGB values and create different variables for each color to pretty much fade from anything to anything. [import]uid: 126161 topic_id: 27325 reply_id: 111029[/import]
The above is correct, you’d have to do it manually. (Just wanted to confirm.) [import]uid: 52491 topic_id: 27325 reply_id: 111044[/import]
Awesome, thanks for that guys! [import]uid: 31262 topic_id: 27325 reply_id: 111053[/import]