Get Color of Gradient. GradientUtil. May 17, 2009
Posted by samoiloff in Actionscript, Color, Drawing, Gradient, Samoiloff.Tags: Actionscript, Class, Color, Gradient, GradienUtil, Samoiloff
trackback
Gradient data in Flash are defined with pairs {color, ratio}. Basic Adobe code that process gradients for drawing is hidden inside Graphics class. So it’s impossible to find color of gradient GradientUtil by basic Flash means.
For this reason I’ve recently wrote very simple GradientUtil class that process gradient data.
Here’s an example of usage:
var colorsArr:Array = [0x00ff00, 0xff0000, 0x0000ff];
var ratiosArr:Array = [0, .5, 1];
trace(GradientUtil.getColorByRatio(.25, colorsArr, ratiosArr));
Comments»
No comments yet — be the first.