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

Flash动画制作
Flash的事件机制:从AsBroadcaster到EventDispatcher
Flash脚本的执行顺序
完全掌握AS中点(.)语法的应用
抗日Flash集之:万里长城永不倒
抗日Flash集之:地道战
抗日Flash集之:抗日新闻
抗日Flash集之:三一八惨案
抗日Flash集之:五四运动
抗日Flash集之:抗日一隅
抗日Flash集之:血染的风采
抗日Flash集之:淞沪抗战
抗日Flash集之:终日到底
抗日Flash集之:东京功略战[游戏]
抗日Flash集之:大中华·1937
抗日Flash集之:长征
抗日Flash集之:抗日宣言
抗日Flash集之:血战钓鱼岛
用Flash MX制作MOV短片
用flash打开本地文件夹
Flash打造迷你特色音乐播放器

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


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