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

Flash动画制作
Flash5键盘鼠标应用(二)
Freehand和Flash的结合应用(4)
Flash5 有声音的三眼狼(二)
Freehand和Flash的结合应用(7)
Freehand和Flash的结合应用(10)
Freehand和Flash的结合应用(12)
Flash5 位移操作(二)
Flash5制作水波倒影效果(二)
Flash5任意两点间随机画线(三)
Flash 神奇遮罩之原理篇(3)
Flash 神奇遮罩之动态篇
Flash 神奇遮罩之图片篇(1)
Flash MX 视频导入功能详解(5)
利用Flash MX模板制作XML动态菜单(1)
用动作脚本动态创建和控制文本框 (6)
FW MX和Flash MX的亲密合作(2)
FW MX和Flash MX的亲密合作(5)
Flash中音量和左右声道平衡的控制(2)
Flash MX的AS绘图和时间控制 下
Flash5 有声音的三眼狼(四)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 65 ::
收藏到网摘: 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++;
      }
   }
};