CGArt-中国CGer中的绿色家园
首页 信息动态 原创排行 互动教程 资源千寻 CG人才 CGArt杂志 艺术设计 CG画廊 CG论坛 酷站欣赏 CG搜索 会员中心
用Flash Actionscript实现渐变填充的代码
来源:网页教学网 作者:闪电儿 编辑:浪漫的季节 发布时间:2007年04月24日 17:18:43

使用Flash MX 2004的Action script可以绘制渐变填充的形状。下面举两个例子:

打开Flash然后按F9输入下面代码:

createEmptyMovieClip ("gradient", 1);
with (gradient) {
colors = [0x323F2E, 0xD6E2D8 ];
alphas = [90,90];
ratios = [0,255];
matrix = {matrixType:"box", x:3, y:4, w:200, h:200, r:2}
beginGradientFill ("linear", colors, alphas, ratios, matrix);
moveTo(50,50);
lineTo(50,200);
lineTo(200,200);
lineTo(200,50);
lineTo(50,50);
endFill();
}

效果如下:

用Flash Actionscript实现渐变填充的代码

第二个例子:

createEmptyMovieClip ("gradient", 1);
with (gradient) {
colors = [0x323F2E, 0xD6E2D8 ];
alphas = [90,100];
ratios = [0,255];
matrix = {a:40, b:0, c:15, d:0, e:100, f:15, g:100, h:215, i:12};
beginGradientFill ("linear", colors, alphas, ratios, matrix);
moveTo(15,15);
lineTo(15,150);
lineTo(150,150);
lineTo(150,15);
lineTo(15,15);
endFill();
}

效果如下:

用Flash Actionscript实现渐变填充的代码

共有评论0条
更多评论..
作者信息 详细信息
评论人:
验证码:
内容:
 
about us advertisement publish conformity service cooperate associate link site map contact us help jump to the top of page