方向盘转向忘记加"-"符号,左正右负

This commit is contained in:
liujing
2022-05-26 11:12:08 +08:00
parent 286f587282
commit ece13a2fcb

View File

@@ -230,14 +230,14 @@ public class SteeringWheelView extends ConstraintLayout {
*/
private void animationWithSteeringData(float steering) {
Log.d(TAG, "方向盘转动" + String.valueOf(steering));
rotateAnimation = new RotateAnimation(fromDegrees, steering,
rotateAnimation = new RotateAnimation(fromDegrees, -steering,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(1000);//旋转时长
rotateAnimation.setFillAfter(true);//旋转后保持原状
autopilotIV.clearAnimation();
autopilotIV.startAnimation(rotateAnimation);
fromDegrees = steering;
fromDegrees = -steering;
}
}