腾讯网首页·手机腾讯网·加入收藏·设为首页·导航
don't delete

您所在的位置: 腾讯首页 > Flash频道 > 基础知识 > 正文

效果演示:极坐标在绘画中的运用
http://flash.QQ.com2007年04月18日11:29   sutroon   评论0

效果演示:

话不多说,参考代码中的注释

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++;

}

}

};

分类信息



企业服务



热点信息











精品FLASH

动画

MTV

游戏

贺卡

网友意见留言板
关于腾讯 | About Tencent | 服务条款 | 广告服务 | 腾讯招聘 | 腾讯公益 | 客服中心 | 网站导航
Copyright © 1998 - 2008 Tencent Inc. All Rights Reserved
腾讯公司 版权所有