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