붉은거위 노트 (redgoose note)

[Actionscript] Gradient box 만들기

Nest
Development
Category
ETC
Hit
460
Star
0
import flash.display.Sprite; 
import flash.display.GradientType; 
import flash.geom.Matrix; 

var box:Sprite = new Sprite(); var gradientColor:Array = new Array(0xFFFFFF, 0x000000); 
var gradientAlpha:Array = new Array(1, 1); 
var gradientRatio:Array = new Array(0,255); 
var gradientMatrix:Matrix = new Matrix(); 

gradientMatrix.createGradientBox(300, 300, Math.PI / 2); 
box.graphics.drawRect(0, 0, 300, 300); 
box.graphics.beginGradientFill(GradientType.LINEAR, gradientColor, gradientAlpha, gradientRatio, gradientMatrix); 
this.addChild(box);

gradientMatrix.createGradientBox(300, 300, Math.PI / 2); 부분에서 각도를 변경할 수 있다.