小小菜鸟的web菜园子

web开发学习。好记性不如烂笔头。每天进步一点点!

导航

记录一些常用的三角公式

 
// substitute mouseX, mouseY with the x, y point to rotate to
dx = mouseX - sprite.x;
dy = mouseY - sprite.y;
sprite.rotation = Math.atan2(dy, dx) * 180 / M
 
创建波形:
// assign value to x, y or other property of srite or movie clip,
// use as drawing coordinates, etc.
public function onEnterFrame(event:Event){
value = center + Math.sin(angle) * range;
angle += speed;
}
 
创建圆形:
// assign position to x and y of sprite or movie clip,
// use as drawing coordinates, etc.
public function onEnterFrame(event:Event){
xposition = centerX + Math.cos(angle) * radius
yposition = centerY + Math.sin(angle) * radius
angle += speed;
}

posted on 2010-11-07 23:44  『小小菜鸟』  阅读(636)  评论(0编辑  收藏  举报