http://bbs.9ria.com/viewthread.php?tid=101161&extra=page%3D1%26amp%3Borderby%3Ddateline%26amp%3Bfilter%3D2592000
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.GradientType;
import flash.geom.Matrix;
var sp:Sprite = new Sprite();
var sh:Shape = new Shape();
var w:Number = 255*2;
var mat:Matrix = new Matrix();
mat.createGradientBox(w,w,0,-w/2,-w/2);
sh.graphics.beginGradientFill(GradientType.RADIAL,[0,0],[1,0],[0,255],mat);
sh.graphics.drawCircle(0,0,w/2);
var sh2:Shape = new Shape();
sh2.graphics.beginGradientFill(GradientType.RADIAL,[0,0],[1,0],[0,255],mat);
sh2.graphics.drawCircle(0,0,w/2);
sp.addChild(sh2);
sp.addChild(sh);
sh.cacheAsBitmap = true;
sh2.cacheAsBitmap = true;
sh.mask = sh2;
this.addChild(sp);
sp.x = 300;
sp.y = 200;
其实就是用一个渐变给这个渐变做alpha mask,flash运算之后就是这个效果(我这里是用和原来一样的渐变)
当然调整一些值还能产生一些边缘平滑的其它效果,比如这个光晕。
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.GradientType;
import flash.geom.Matrix;
var sp:Sprite = new Sprite();
var sh:Shape = new Shape();
var w:Number = 255*2;
var mat:Matrix = new Matrix();
mat.createGradientBox(w,w,0,-w/2,-w/2);
sh.graphics.beginGradientFill(GradientType.RADIAL,[0,0],[1,0],[0,255],mat);
sh.graphics.drawCircle(0,0,w/2);
var sh2:Shape = new Shape();
sh2.graphics.beginGradientFill(GradientType.RADIAL,[0,0],[1,0],[70,255],mat);
sh2.graphics.drawCircle(0,0,w/2);
sp.addChild(sh2);
sp.addChild(sh);
sh.cacheAsBitmap = true;
sh2.cacheAsBitmap = true;
sh.mask = sh2;
this.addChild(sp);
sp.x = 300;
sp.y = 200;
- 大小: 17.5 KB
- 大小: 18.6 KB
- 大小: 17.9 KB
分享到:
相关推荐
一个渐变旋转的圆环
图片渐变旋转模块.rar
UIView的颜色渐变效果,一种颜色从透明度0到透明度1的渐变,以及多种颜色之间的渐变
针对渐变的特点,提出了一种基于非相邻帧差的通用渐变镜头检测方法,该方法利用非相邻帧差有效地突出了渐变的特征,利用窗口最大值准确地找到渐变的中心位置,该方法不用设置全局阈值,与具体的渐变转换效果无关,...
一种灵活的彩虹渐变色简洁算法,vb6源码,主体仅有13行代码,可应用到任意长度及方向的色条,以及任意半径的圆弧,
自定义ViewPager滑动同时显示颜色渐变并显示相邻Fragement边缘
射线渐变中心移动的四种方法。图片法:填充射线渐变,复制粘贴为图片,裁剪图片。补位法:绘制一大一小两个形状,组合起来,给组合填充射线渐变,Alt F10调出选择窗口,隐藏较大的矩形,移动小矩形的位置。旋转法:...
彩色渐变旋转圆盘
AE的渐变转场效果.pdf 学习资料 复习资料 教学资源
圆弧绕圆心旋转的同时,颜色渐变
2500种ps专用颜色渐变!
基于unity3D实现渐变颜色的简单脚本,代码很少,就不废话了,直接上代码和效果图。 效果图: using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace ...
基于QT4的图像渐变软件,包括源代码,实现图像的渐变淡化功能
unity3d实现物体透明渐变效果,只需要将脚本放在物体上即可
在易语言中也可以实现漂亮的渐变色自绘菜单
移动web字体图标、平面转换、渐变
iOS渐变,支持——线性渐变,径向渐变,渐变动画,lable字体渐变,lable字体渐变动画
要实现窗口(如菜单、按钮、主背景等)背景颜色的多样化,有很多种实现方法,其中颜色渐变就是一种比较常见的方法。它简单实用,即改变了窗口背景颜色的单调,又实现简单。主要方法有很多种,各有各的算法和特点。我...
能够实现渐变颜色的线条旋转,无违和感,解决了渐变的难题。
100种photoshop渐变grd 非常完整 不用到处下载