Line Gradient Test
package {
import flash.display.GradientType;
import flash.display.Shape;
import flash.display.Sprite;
[SWF(width=550, height=400)]
public class Main extends Sprite {
public function Main() {
// Create and center ellipse shape on stage
var ellipse:Shape = new Shape();
addChild(ellipse);
ellipse.x = stage.stageWidth / 2;
ellipse.y = stage.stageHeight / 2;
// Set basic line style
ellipse.graphics.lineStyle(30);
// Set up gradient properties
var colors:Array =
[
0xFF0000,
0xFF6600,
0xFFFF00,
0x00FF00,
0x0000FF,
0x2E0854,
0x8F5E99
];
var alphas:Array = [1,1,1,1,1,1,1];
var ratios:Array = [0,42,84,126,168,210,255];
// Set gradient line style
ellipse.graphics.lineGradientStyle(GradientType.LINEAR, colors, alphas, ratios);
// Draw ellipse
ellipse.graphics.drawEllipse(-100, -50, 200, 100);
}
}
}
Related examples in the same category
1. | Create Gradient box | | |
2. | Create a Ball by using the Gradient | | |
3. | Applying Gradients to Lines | | |
4. | Set line gradient style with Matrix | | |
5. | lineGradientStyle("linear", [0xFFFF00, 0x00FFFF], [100, 100], [0x00, 0xFF], mxBox, "reflect", "linearRGB") | | |
6. | lineGradientStyle("radial", [0xFFFF00, 0x00FFFF], [100, 100], [0x00, 0xFF], mxBox, "pad", "linearRGB") | | |
7. | lineGradientStyle("radial", [0xFFFF00, 0x00FFFF], [100, 100], [0x00, 0xFF], mxBox, "pad", "linearRGB", 1) | | |
8. | Applying Gradient Fills | | |
9. | A shape with evenly rounded corners | | |
10. | Rotating Objects with Filters | | |