我有一个立方体的ModelVisual3D,想让它绕着自己的轴旋转360度。我创建了一个RotationTransform3D并告诉它旋转360度,但它根本没有旋转,而且如果你说270度,它只旋转90度,但是是朝相反的方向。我猜计算机计算了旋转的“最短路径”。我想到的最好的解决方案是制作一个动画来旋转180度,然后在它完成后调用另一个180度来完成完整的旋转。是否有一种方法可以在一个动画中完成它?
RotateTransform3D rotateTransform = new RotateTransform3D();
myCube.Model.Transform = rotateTransform;
AxisAngleRotation3D rotateAxis =
new AxisAngleRotation3D(new Vector3D(0, 1, 0), 180/*or 360*/);
Rotation3DAnimation rotateAnimation =
new Rotation3DAnimation(rotateAxis, TimeSpan.FromSeconds(2));
rotateTransform.BeginAnimation(RotateTransform3D.RotationProperty,
rotateAnimation);