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 Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

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
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

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
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest