CanvasScript3
>
Tests
> Graphics - BeginRadialGradientFill
Replacement for Graphics.beginGradientFill(type=GradientType.RADIAL)
Code
var stage = new Stage("canvas", 420, 500, 30); var shape; // 2 colors shape = new Shape(); shape.x = 20; shape.y = 20; shape.graphics.beginRadialGradientFill([0xFF0000, 0x0000FF], [1, 1], [0, 255], 50, 50, 0, 50, 50, 50); shape.graphics.drawRect(0, 0, 100, 100); shape.graphics.endFill(); stage.addChild(shape); // 3 colors shape = new Shape(); shape.x = 20; shape.y = 140; shape.graphics.beginRadialGradientFill([0xFF0000, 0x0000FF, 0x00FF00], [1, 1, 1], [0, 127, 255], 50, 50, 0, 50, 50, 50); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape); // alpha shape = new Shape(); shape.x = 20; shape.y = 260; shape.graphics.beginRadialGradientFill([0xFF0000, 0xFF0000], [1, 0], [0, 255], 50, 50, 0, 50, 50, 50); shape.graphics.drawRect(0, 0, 100, 100); shape.graphics.endFill(); stage.addChild(shape);
Canvas
Output