将关键帧命令和 -vc (valueChange) 选项结合使用,并将“rand MIN MAX”作为参数传递。例如,要随机化介于 1.5 和 3.2 之间的 sphere.tx:
float $random;
int $n=`keyframe -q -kc sphere.tx`;
//total number of keyframes in tx
for($i=0;$i<$n;$i++) {
$random=`rand 1.5 3.2`;
keyframe -e -at tx -in $i -vc $random sphere;
}
若要随机化所有属性,可以写入上循环,从而更改要随机化的属性。