0

编程新手......我想让物体以不同的速度在闪光中直线下降。有点像 ascii 艺术从顶部向下落到画板底部的形状。有600件。所以必须有一个更好的方法来自动化这个。问题是艺术品在illustrator中是分层的。所以我想应用一个脚本来随机使每一层下降 375 像素。我使用的脚本用于创建形状和移动。不导入已经制作的形状......帮助!

我是否将动作脚本放在每个符号中?

提前致谢。derob357

function moveDown(e:Event):void {      e.target.y += speed; /* e.target refers to circle_mc. We    are incrementing the y property to make it move down */       /* This will stop the animation when the movie clip reaches a certain point */      if(e.target.y >= 350)      {           circle_mc.removeEventListener(Event.ENTER_FRAME, moveDown);      } }
4

1 回答 1

1

在您的变速中,您可以通过以下Math.random()功能轻松使其成为随机速度:

var high:int = 10;
var low:int = 1;
var speed:Number = Math.floor(Math.random()*(1+high-low))+low;

这将生成一个介于 1 和 10 之间的随机数,更改变量高和低以更改限制。

于 2013-10-13T17:15:25.540 回答