当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > 极坐标在绘画方法中的运用

Flash动画制作
Flash MV音乐和字幕的制作(下)
最强大的Flash反编译工具(一)
Flash制作空战游戏(四)
Flash菜单轻松做 上
Flash菜单轻松做 下
Flash 三小时上手
Flash 三小时上手(二)
Flash 三小时上手(三)
Flash5 位移操作(三)
Flash层的运用(三)
Flash层的运用(四)
实例学用Flash MX增强的AS功能(1)
Flash MX的自由变形工具(2)
Flash MX 视频导入功能详解(1)
Flash MX 文本工具手册(1)
Flash MX 文本工具手册(2)
Flash MX 文本工具手册(3)
Flash MX 文本工具手册(4)
Flash MX 文本工具手册(5)
Flash MX 文本工具手册(6)

Flash动画制作 中的 极坐标在绘画方法中的运用


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 86 ::
收藏到网摘: n/a


话不多说,参考代码中的注释
var pice = 8;
//瓣数
var amp = 180;
//半径
x0 = 550/2;
//中心X坐标
y0 = 400/2;
//中心Y坐标
degree = 0;
//初始角
speed = 2;
//画线速度
colorF = 0xFF0000;
//线条颜色
_root.createEmptyMovieClip("flower", 1);
//创建MC
with (flower) {
   flower.moveTo(x0+amp, y0);
   //移动起始点
   flower.lineStyle(3, colorF, 100);
   //定义线条样式
}
flower.onEnterFrame = function() {
   //开始画线
   if (degree<=360) {
      for (i=1; i<=speed; i++) {
         radian = Math.PI/180*(degree);
         p = amp*Math.cos(pice/2*radian);
         x = x0+p*Math.cos(radian);
         y = y0+p*Math.sin(radian);
         this.lineTo(x, y);
         degree++;
      }
   }
};