Colour Blending/Interpolation (gradual changing)

For questions about using Classic.

Post » Wed Oct 26, 2011 12:48 pm

Does Construct provide a way to do colour blending? Meaning, I specify a 1st and a 2nd colour, and then I want the interpolated colours that connect these colours.

For example, I want a sprite to gradually change from 1 colour to another as I scale it. pooiyx2011-10-26 12:48:52
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Wed Oct 26, 2011 12:55 pm

Like lerp(rgb(0,0,0),rgb(255,255,255),t)?
Image ImageImage
B
166
S
49
G
154
Posts: 8,108
Reputation: 100,237

Post » Wed Oct 26, 2011 1:34 pm

That would do for gradually changing colors, but the 'blending' is a whole other monster. You could always take 2 transparent objects and overlap them, making a new color..that's probably not the most elegant solution though :)
Image
B
238
S
28
G
13
Posts: 1,787
Reputation: 18,485

Post » Wed Oct 26, 2011 4:02 pm

I would use newt's formula, but for it to look like it was blending between colors as opposed to traveling through all colors to get to the right one, you need to lerp each component like
rgb(lerp(0,255,t),lerp(0,50,t),lerp(78,34,t))

You can make a pv for the value t, and increment it every tick, or you can use the math plugin to do an autointerpolation of a value "t", from 0 to 1, and give the total time, and have it automatically increment the value t which you could put there as welllucid2011-10-26 16:03:39
Spriter Dev
B
97
S
21
G
12
Posts: 3,259
Reputation: 16,844


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests