比方说,我有一个从第0帧开始的补间动画,它有100x100大小。然后在第20帧,大小变为100x500,因此电影剪辑将垂直拉伸。如果我想要取值在450到550之间,这样当我快速播放动画时,动画看起来就不一样了?我觉得它需要动作脚本(3.0优先),但我尝试访问电影剪辑的变量,但找不到任何接近我的要求。
主要我想随机化的大小,位置,倾斜,如果可能的话,发光滤镜的颜色。(例如,150的R +- 10%和64的绿色+- 10% )
在批量生产此MC时将非常有用,这样动画就不会看起来如此重复。
发布于 2012-07-12 00:28:54
在您的例子中,您可能不想对动画进行“评分”,而是使用ActionScript 3来编写调整动画的脚本。这可以通过使用AS3提供的FlashTween类来完成。
// import the namespaces
import fl.transitions.Tween;
import fl.transitions.easing.*;
var endHeight:Number = Math.random() * 100 + 450;
var startHeight:Number = 100;
var myTween:Tween = new Tween(your_movie_clip, "height", Elastic.easeOut, startHeight, endHeight, 20);有关Tween类的更多信息可以在Adobe和this tutorial上找到。
发布于 2012-07-12 00:19:51
您可能希望使用Math.random()函数。
//$mc is my movieclip
$mc.width = (Math.random()*100)+450;发布于 2012-07-12 00:28:08
由于您要创建的补间是动态的,并且不能在编译期间由flash预先计算,因此您必须以编程方式创建它。
要做到这一点,您可以从头开始手动完成,也可以使用Tween类。
// myMC is the movie clip reference you want to resize
new Tween(myMC, "height", Bounce.easeIn, 100, 450 + Math.round(Math.random() * 100), 20, false);看一看http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Tween.html
M.
https://stackoverflow.com/questions/11436917
复制相似问题