Actionscript 3 如何在圆形轨道中对齐电影唇?
as3中电影唇的圆形对齐? 我在以圆形方式移动和对齐movieclips时遇到问题Actionscript 3 如何在圆形轨道中对齐电影唇?,actionscript-3,Actionscript 3,as3中电影唇的圆形对齐? 我在以圆形方式移动和对齐movieclips时遇到问题 for(var i:int;i<15;i++) { var obj:mc = new mc(); obj.scaleX = obj.scaleY = 0.5; this.addChild(obj); obj.gotoAndStop(i); obj.centerX = 372.3; obj.centerY = stage.stageHeight/2;
for(var i:int;i<15;i++)
{
var obj:mc = new mc();
obj.scaleX = obj.scaleY = 0.5;
this.addChild(obj);
obj.gotoAndStop(i);
obj.centerX = 372.3;
obj.centerY = stage.stageHeight/2;
//for tilt objects
//obj.angle = 200 - i*36;
obj.angle = i*24; //for spaceing objects 36 for 10;
obj.radius = 300;
itemArray.push(obj);
}
allign();
for(var i:int;i使用三角方程相对于中心定位您的电影嘴唇
解决方案
//Suppose the point center c={x:0, y:0}, and radius constant r=100;
// define pool of data type Vector for your Items(MovieClips)
var objectPool:Vector.<Item>=new Vector.<Item>();
//generate pool for your items and add them around the center
var numItems:int=4;
var angle:Number=360/numItems;
//suppose you have a custom class ClipItem as a blue print for your clips
var clipItem:ClipItem;
var _x:Number, _y:Number;
for(var i:int=0; i<numItems)
{
clipItem=new ClipItem;
_x=c.x+Math.sin(angle)*r;
_y=c.y+Math.cos(angle)*r;
clipItem.x=_x; clipItem.y=_y;
angle+=angle;
//You might need reference to the clips for other interactions
// such as moving them around. putting them in one place is ideal.
objectPool.push(clipItem);
}
//假设点中心c={x:0,y:0},半径常数r=100;
//为项目定义数据类型向量池(MovieClips)
变量对象池:向量。=新向量。();
//为您的项目生成池并围绕中心添加它们
变量numItems:int=4;
变量角度:数值=360/numItems;
//假设您有一个自定义类ClipItem作为剪辑的蓝图
var-clipItem:clipItem;
变量x:Number,变量y:Number;
for(var i:int=0;ifunction allign(){for(var i:int;i可能是相关的:请记住,sin
和cos
需要弧度而不是度作为参数。因此,angle
应该实例化为var angle:Number=(360/numItems)*Math.PI/180
。