Radial gradient fill example
http://johnblackburne.blogspot.co.uk/2012/03/radial-gradient-fill.html
♥0 |
Line 26 |
Modified 2012-03-26 11:11:08 |
MIT License
archived:2017-03-20 11:23:06
ActionScript3 source code
/**
* Copyright John_Blackburne ( http://wonderfl.net/user/John_Blackburne )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/guKK
*/
package {
import flash.display.GradientType;
import flash.display.Sprite;
import flash.display.Graphics;
import flash.display.SpreadMethod;
import flash.geom.Matrix;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var fX:Number, fY:Number, fR:Number, iRing:int, fSize:Number;
var mat:Matrix;
var g:Graphics = graphics;
fSize = 60;
mat = new Matrix();
for (iRing = 0; iRing < 20; iRing++) {
fX = fSize + Math.random() * (stage.stageWidth - 2 * fSize);
fY = fSize + Math.random() * (stage.stageHeight - 2 * fSize);
fR = 0.5 * fSize * (1 + Math.random());
mat.createGradientBox(2 * fR, 2 * fR, 0, fX - fR, fY - fR);
g.beginGradientFill(GradientType.RADIAL,
[0xd0d000, 0x6060ff], [1, 1], [0x20, 0xff],
mat, SpreadMethod.PAD);
g.drawCircle(fX, fY, fR);
}
}
}
}