//clean up keys for in-betweens where the rotation got flipped//

select -cl;
select -hi armCurves;
select -d armCurves;
select -d "*Shape*";
string $string_curves[] = `ls -sl`;
int $time = 3;

for ($n = 0; $n < size($string_curves); $n++) {

select -cl;
currentTime $time;

for ($m = 1; $m < 101; $m++) {

string $rotfixx = ("stB2_Cluster"+($m)+"Handle.rotateX");
string $rotfixy = ("stB2_Cluster"+($m)+"Handle.rotateY");
string $rotfixz = ("stB2_Cluster"+($m)+"Handle.rotateZ");
float $fixx1;
float $fixy1;
float $fixz1;
float $fixx2;
float $fixy2;
float $fixz2;
float $fixx3;
float $fixy3;
float $fixz3;

$fixx1 = `getAttr $rotfixx`;
$fixy1 = `getAttr $rotfixy`;
$fixz1 = `getAttr $rotfixz`;

$time = $time + 2;
currentTime $time;

$fixx3 = `getAttr $rotfixx`;
$fixy3 = `getAttr $rotfixy`;
$fixz3 = `getAttr $rotfixz`;

//compare the rotations on the keys//

float $solxa = abs($fixx1 - $fixx3);

if ($solxa > 200) {

if ($fixx3 < 0) {

$fixx3 = 360 + $fixx3;

} else {

$fixx3 = $fixx3 - 360;

}

}


float $solya = abs($fixy1 - $fixy3);

if ($solya > 200) {

if ($fixy3 < 0) {

$fixy3 = 360 + $fixy3;

} else {

$fixy3 = $fixy3 - 360;

}

}

float $solza = abs($fixz1 - $fixz3);

if ($solza > 200) {

if ($fixz3 < 0) {

$fixz3 = 360 + $fixz3;

} else {

$fixz3 = $fixz3 - 360;

}

}


string $curClusterRotFix = ("stB2_Cluster"+($m)+"Handle.rotate");

setAttr $rotfixx $fixx3;
setAttr $rotfixy $fixy3;
setAttr $rotfixz $fixz3;
setKeyframe -breakdown 0 $curClusterRotFix;

$time = $time - 2;
currentTime $time;

}

$time = $time + 2;
currentTime $time;

}

Go back to String Creation.