Re: [Flashcoders] Calculate Color on a Gradient Given a Percentage

2006-06-17 Thread Bernard Poulin
this works for me: */** @param factor is between 0 and 1 (if higher/lower, it will clip correctly) */* *public* *static* *function* mixColor(a:*Number*, b:*Number*, factor:*Number *):*Number* { *if*(factor >= 1) *return* a; *if*(factor <= 0) *return* b; *var* fb:*Number* = 1-factor; *return* (

RE: [Flashcoders] Calculate Color on a Gradient Given a Percentage

2006-06-16 Thread Tor.Kristensen
Hi Jeff, Here's a class that will generate an array for N elements that blends between two RGB values. Example: import org.bespoke.color.ColorBlend; var myBlender:ColorBlend=new ColorBlend(0xFF,0x00FF00); //to get the RGBN value at 46% between the two... var

[Flashcoders] Calculate Color on a Gradient Given a Percentage

2006-06-16 Thread Jeff Mastropietro
I'm looking for a function that would return a hex color given 2 end points of a color gradient and a percentage. My idea is to color code search results based on a calculation. This calculation would be different than the calculation used to sort the results. Possible function: function ca