Interpolate Colors?

Member Posts: 75

Im trying to get a sky-time effect, meaning, I want my "Sky" actor which by default is set to a light blue, to slowly progress to a dark black (night) color, and then at that point, progress back to blue, Is there any way I can make this happen?
I realize I would need a timer set to roughly every 0.2 seconds change its color, but I can't tell it to set its self.color.red to -1 because that would set it immedietly to -1, I just want it to subtract its Red number (In RGB) by 1 every 0.2 seconds, I would appreciate the help!

• I am here.Member, Sous Chef, PRO Posts: 6,577
edited September 2014

Hi @SikkJewFro you answered your own question in your thread title with the word Interpolate - so you can use that behaviour to get the result you're after (this has a time factor built into it).

To point out, the RGB colours in GSC are between the ranges of 0 and 1 so (apart from little "tricks" to input 0 to 255 values) you use fractions of 1.

So try something like this (however many minutes changed to seconds in the time part; for this example I'm using 10 minutes) start setting self.Red to 0, Green as something like .75, Blue as 1 (straightforward way to get darker and darker blue and finally to black, then back again, repeating):

``````Rule: When self.Color.Green = 0.75
Interpolate self.Color.Green to 0
Time: for 600 seconds
Rule: ---- nested--- When self.Color.Green < 0.51
Interpolate self.Color.Blue to 0
Time: for 300 seconds

Rule: When self.Color.Green = 0
Interpolate self.Color.Green to 0.75
Time: for 600 seconds
Interpolate self.Color.Blue to 0
Time: for 300 seconds
``````

""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

• Member Posts: 9,914

You might need to do it in stages. Moving between intermediary colors. Basically interpolating to say five color schemes.

• London, UK.Member Posts: 12,822
edited September 2014

The most straightforward way would be to create an actor, change its colour to blue, then fade it in and out by interpolating its alpha channel.

You could even constrain its opacity to a sine wave so it oscillates back and forth between 0 and 1 at whatever speed you need.

• I am here.Member, Sous Chef, PRO Posts: 6,577
edited September 2014

@SikkJewFro

@Socks way is the better way to go! Very straightforward: make sure your background behind the sky actor is black, then in the blue sky actor:

``````Rule: When self.Color.Alpha =1
Interpolate self.Color.Alpha to 0
Timer 600 seconds --- or whatever else is needed

Rule: When self.Color.Alpha =0
Interpolate self.Color.Alpha to 1
Timer 600 seconds --- or whatever else is needed
``````

""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

• London, UK.Member Posts: 12,822
edited September 2014

@gyroscope said:
. . . make sure your background behind the sky actor is black . . .

Whoops, yep, forgot to mention that, like you say the background will need to be black.

These are the values you would use if you wanted it to oscillate back and forth between blue and black (or blue and transparent), constrain the alpha channel to . . .

0.5*sin(game.Time *20)+0.5

('20' is the speed).