Using a timer property this can be done:
timer = ob['timer_prop']
time = 5 # time taken for colour change to complete
col = [1,0,0,1]
# Assuming that we want the colour to fade from black:
col[0] *= (timer/time)
col[1] *= (timer/time)
col[2] *= (timer/time)
if timer < time: Rasterizer.setBackgroundColor(col)
But thats pretty simple and not ver flexible, a more complex method can be done by taking the difference of the current colour and the desired colour and ramping it for the time specified, EG:
#Current colour
cur = [0,0,1,1]
# Next colour
next = [1,0,0,1]
# Difference in colours
dif = next
dif[0] -= cur[0]
dif[1] -= cur[1]
dif[2] -= cur[2]
timer = ob['timer_prop']
time = 5
col = cur
col[0] += dif[0]*(timer/time)
col[1] += dif[1]*(timer/time)
col[2] += dif[2]*(timer/time)
if timer < time: Rasterizer.setBackgroundColor(col)
I don’t know of any methods to get the BG colour, so keep a tab on it.
Note that the timer_prop should start at 0 or you will get some weird results, so reset the timer when you start the colour change.