And here's an example changing the rotation in 3D Track Motion
var endKeyframe = myTrack3D.TrackMotion.InsertMotionKeyframe(
new Timecode(picInterval * (i - 1) + moveInterval)
);
endKeyframe.Height = endKeyframe.Height * picWidth / endKeyframe.Width;
endKeyframe.Width = picWidth;
//generating random rotation it's not different enough from the previos one
do {
newRotation = (Math.random() - 0.5) * 2 * maxRotationDegree;
} while (Math.abs(newRotation - prevRotation) <= minRotationDifference);
endKeyframe.OrientationZ = newRotation;
Hopefully that will help you get started in the right direction.