Return to Snippet

Revision: 13956
at May 14, 2009 10:01 by sidneydekoning


Initial Code
// Please note that the rotation is in radians!To convert from degrees to radians: degrees * Math.PI / 180;

var grad:String = GradientType.LINEAR;
var linMatrix:Matrix = new Matrix( );
var rotationDegrees:int = 90
linMatrix.createGradientBox( WIDTH, HEIGHT, (rotationDegrees * Math.PI / 180) );

var colors:Array = [ Colors.GRAD_BLACK, Colors.GRAD_LIGHT_BLACK ];
var alphas:Array = [ 1, 0.9 ];
var ratios:Array = [ 0, 255 ];
var focalPoint:Number = .0;

graphics.beginGradientFill( grad , colors , alphas , ratios , linMatrix , SpreadMethod.PAD, InterpolationMethod.RGB, focalPoint); 
graphics.drawRect( 0, 0, WIDTH -4 , HEIGHT);
graphics.endFill( );

Initial URL


Initial Description


Initial Title
Draw a Linear Gradient

Initial Tags


Initial Language
ActionScript 3